classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: URLClassLoader


From: Mark Wielaard
Subject: Re: URLClassLoader
Date: Tue, 17 Jul 2001 01:44:29 +0200
User-agent: Mutt/1.3.18i

Hi Nic (and list),

On Mon, Jul 16, 2001 at 05:25:12AM +0100, Nic Ferrier wrote:

> There's a small bug in URLClassLoader.
> 
> In the longer findResource method you create a URL for JAR files...
> you open a connection to the URL in the hope that you'll get an
> IOException if the JAR entry isn't there, but it doesn't work like
> that.
> 
> Instead you should connect the connection.
Yeah, you are right. Thanks.
I will check in this patch.

2001-07-17  Nic Ferrier <address@hidden>

    * java/net/URLClassLoader.java (findResource): use URLConnection.connect()
    to test if the connection is really valid

diff -u -u -r1.1 URLClassLoader.java
--- java/net/URLClassLoader.java        2001/03/19 22:19:20     1.1
+++ java/net/URLClassLoader.java        2001/07/16 23:31:54
@@ -352,8 +352,10 @@
         }
 
         // Check if the resource is actually at that location
+        // we MUST open the connection to ensure the location gets checked
         try {
-            resourceURL.openConnection();
+            URLConnection u = resourceURL.openConnection();
+            u.connect();
         } catch (IOException ioe) {
             return null;
         }

> Because GCJ's URLClassLoader doesn't seem to work I'll be pinching
> this for a GCJ implementation so Paperclips can load webapps.
 
Note that I wrote the Classpath version a long time ago and have not really
tested it. I wanted to merge it with the libgcj version but after we got
real 1.2 Classloading support finished. If you could merge and test the
two versions that would be very appreciated.

Cheers,

Mark
-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore



reply via email to

[Prev in Thread] Current Thread [Next in Thread]