From 198f8870f23870485115ec91db50c0e172525889 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 11 Jan 2005 20:40:10 +0000 Subject: re PR libgcj/13972 (gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly.) 2005-01-11 Michael Koch 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/java/net/URL.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libjava/java/net/URL.java') diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java index 4353662..96f9799 100644 --- a/libjava/java/net/URL.java +++ b/libjava/java/net/URL.java @@ -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(); -- cgit v1.1