[kaffe] CVS kaffe (guilhem): Fixed URL context handling.

Kaffe CVS cvs-commits at kaffe.org
Wed Dec 31 01:12:02 PST 2003


PatchSet 4248 
Date: 2003/12/31 09:09:36
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixed URL context handling.

Members: 
	ChangeLog:1.1835->1.1836 
	libraries/javalib/java/net/URL.java:1.36->1.37 
	libraries/javalib/java/net/URLStreamHandler.java:1.14->1.15 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1835 kaffe/ChangeLog:1.1836
--- kaffe/ChangeLog:1.1835	Tue Dec 30 18:22:59 2003
+++ kaffe/ChangeLog	Wed Dec 31 09:09:36 2003
@@ -1,3 +1,9 @@
+2003-12-31  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* libraries/javalib/java/net/URL.java,
+	libraries/javalib/java/net/URLStreamHandler.java:
+	Fixed handling of URL given relative to a context URL.
+
 2003-12-30  Guilhem Lavaux <guilhem at kaffe.org>
 
 	* tests/regression/BufferedReaderTest.java: Removed too strict
Index: kaffe/libraries/javalib/java/net/URL.java
diff -u kaffe/libraries/javalib/java/net/URL.java:1.36 kaffe/libraries/javalib/java/net/URL.java:1.37
--- kaffe/libraries/javalib/java/net/URL.java:1.36	Sat Dec 27 21:15:58 2003
+++ kaffe/libraries/javalib/java/net/URL.java	Wed Dec 31 09:09:38 2003
@@ -396,6 +396,8 @@
 	    host = context.host;
 	    port = context.port;
 	    file = context.file;
+	    if (file == null || file.length() == 0)
+	      file = "/";
 	    authority = context.authority;
 	  }
       }
@@ -408,6 +410,8 @@
 	host = context.host;
 	port = context.port;
 	file = context.file;
+	if (file == null || file.length() == 0)
+	  file = "/";
         authority = context.authority;
       }
     else	// Protocol NOT specified in spec. and no context available.
Index: kaffe/libraries/javalib/java/net/URLStreamHandler.java
diff -u kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.14 kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.15
--- kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.14	Sat Dec 27 21:15:58 2003
+++ kaffe/libraries/javalib/java/net/URLStreamHandler.java	Wed Dec 31 09:09:38 2003
@@ -126,7 +126,7 @@
     int port = url.getPort();
     String file = url.getFile();
     String ref = url.getRef();
-    
+
     if (spec.regionMatches (start, "//", 0, 2))
       {
 	String genuineHost;
@@ -186,8 +186,6 @@
 	// No file context available; just spec for file.
 	// Or this is an absolute path name; ignore any file context.
 	file = spec.substring(start, end);
-	if (start < end && spec.charAt(start) != '/')
-	  file = "/" + file;
 	ref = null;
       } 
     else if (start < end)




More information about the kaffe mailing list