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 <[EMAIL PROTECTED]>

    * 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

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to