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

        * 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;
          }


_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to