re PR libgcj/13972 (gcj's URL() does not handle ContextURL + "/redir?http://domain2...
authorMichael Koch <konqueror@gmx.de>
Tue, 11 Jan 2005 20:40:10 +0000 (20:40 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Tue, 11 Jan 2005 20:40:10 +0000 (20:40 +0000)
2005-01-11  Michael Koch  <konqueror@gmx.de>

PR libgcj/13972
* java/net/URL.java (URL): Handle specs like
"/redir?http://domain2.com/index.html" which start with a slash.

From-SVN: r93197

libjava/ChangeLog
libjava/java/net/URL.java

index 3c962937681956889e88dd831ea87d7dd81cd9d7..918f99f087d0b53d19ea284aaa103f808bebaae5 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-11  Michael Koch  <konqueror@gmx.de>
+
+       PR libgcj/13972
+       * java/net/URL.java (URL): Handle specs like
+       "/redir?http://domain2.com/index.html" which start with a slash.
+
 2005-01-11  Michael Koch  <konqueror@gmx.de>
 
        PR libgcj/14012, PR libgcj/14013, PR libgcj/15157, PR libgcj/15509
index 4353662908a6289f2c44bb890c521b02b0992acf..96f97991280e4b4331e2d1e2151ccc22adfe4a6c 100644 (file)
@@ -392,13 +392,14 @@ public final class URL implements Serializable
     // right after the "://".  The second colon is for an optional port value
     // and implies that the host from the context is used if available.
     int colon;
+    int slash = spec.indexOf('/');
     if ((colon = spec.indexOf("://", 1)) > 0
+       && ((colon < slash || slash < 0))
         && ! spec.regionMatches(colon, "://:", 0, 4))
       context = null;
 
-    int slash;
     if ((colon = spec.indexOf(':')) > 0
-        && (colon < (slash = spec.indexOf('/')) || slash < 0))
+        && (colon < slash || slash < 0))
       {
        // Protocol specified in spec string.
        protocol = spec.substring(0, colon).toLowerCase();
@@ -429,8 +430,6 @@ public final class URL implements Serializable
        authority = context.authority;
       }
     else // Protocol NOT specified in spec. and no context available.
-
-
       throw new MalformedURLException("Absolute URL required with null context");
 
     protocol = protocol.trim();