classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] Re: Absolute URL parsing bug


From: Andrew Haley
Subject: Re: [cp-patches] Re: Absolute URL parsing bug
Date: Thu, 7 Jul 2005 17:27:22 +0100

I think this is the right fix.  Tested with Mauve, no regressions.

Fixes the testcase 

context = "jar:file://www.example.com/test.jar!/foo/bar.txt", 
spec = "jar:file://www.example.com/test.jar!/foo/test.txt"

which previously caused a NullPointerException.

Andrew.




2005-07-07  Andrew Haley  <address@hidden>

        * java/net/URL.java (URL): If the file part of a spec is absolute,
        ignore the file part of its context.

Index: URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.52
diff -p -2 -u -r1.52 URL.java
--- URL.java    30 Jun 2005 03:20:01 -0000      1.52
+++ URL.java    7 Jul 2005 16:21:14 -0000
@@ -409,8 +409,11 @@ public final class URL implements Serial
            host = context.host;
            port = context.port;
-           file = context.file;
             userInfo = context.userInfo;
-           if (file == null || file.length() == 0)
-             file = "/";
+           if (spec.indexOf(":/", 1) < 0)
+             {
+               file = context.file;
+               if (file == null || file.length() == 0)
+                 file = "/";
+             }
            authority = context.authority;
          }




reply via email to

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