[Patch] PR libgcj/13972 - URL with URL in spec part
Michael Koch
konqueror@gmx.de
Tue Jan 11 19:12:00 GMT 2005
Hi list,
I wrote the attached patch to fix PR libgcj/13972. We now handle URL
parts in the spec for an URL. I added some testcases for mauve about this.
All testcases pass. No regressions.
Ok to commit to trunk ?
Michael
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.
-------------- next part --------------
Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.44
diff -u -r1.44 URL.java
--- java/net/URL.java 17 Nov 2004 08:40:53 -0000 1.44
+++ java/net/URL.java 11 Jan 2005 19:09:08 -0000
@@ -392,13 +392,14 @@
// 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 @@
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();
More information about the Java-patches
mailing list