[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: java.net.URL and java.net.URLStreamHandler
From: |
Guilhem Lavaux |
Subject: |
FYI: java.net.URL and java.net.URLStreamHandler |
Date: |
Tue, 30 Dec 2003 20:01:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 |
Hi,
Finally here is the patch which should solve the problems encountered
with URLs concerning relative path transformed into absolute path. I'll
commit it tomorrow. I've corrected some mauve tests to make them pass
with JDK and follow more closely the spec.
Guilhem.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.1737
diff -u -r1.1737 ChangeLog
--- ChangeLog 29 Dec 2003 21:50:35 -0000 1.1737
+++ ChangeLog 30 Dec 2003 18:57:02 -0000
@@ -1,3 +1,11 @@
+2003-12-30 Guilhem Lavaux <address@hidden>
+
+ * java/net/URLStreamHandler.java
+ (parseURL): Leave path relative in any case.
+
+ * java/net/URL.java
+ (URL): Change context path to "/" if it is empty.
+
2003-12-29 Guilhem Lavaux <address@hidden>
* java/text/RuleBasedCollator.java,
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v
retrieving revision 1.24
diff -u -r1.24 URL.java
--- java/net/URL.java 25 Dec 2003 16:36:55 -0000 1.24
+++ java/net/URL.java 30 Dec 2003 18:57:02 -0000
@@ -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: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLStreamHandler.java,v
retrieving revision 1.23
diff -u -r1.23 URLStreamHandler.java
--- java/net/URLStreamHandler.java 29 Dec 2003 12:04:50 -0000 1.23
+++ java/net/URLStreamHandler.java 30 Dec 2003 18:57:02 -0000
@@ -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)
- FYI: java.net.URL and java.net.URLStreamHandler,
Guilhem Lavaux <=