[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: URLStreamHandler.parseURL()
From: |
Mark Wielaard |
Subject: |
Re: URLStreamHandler.parseURL() |
Date: |
Sun, 11 Jul 2004 18:52:30 +0200 |
Hi,
On Tue, 2004-07-06 at 18:31, Mohan Embar wrote:
> >Please apply your patch.
>
> Done. (I also updated the copyright.)
>
> I did this to the libgcj tree because I don't think I have
> commit access to Classpath.
I have now also tested it against GNU Classpath (on a GNU/Linux
platform) and comitted it as follows:
2004-07-11 Mohan Embar <address@hidden>
* java/net/URLStreamHandler.java (parseURL): Canonicalize
file portion of URL in addition to spec for file: protocol.
Sorry this didn't make the final 0.10 release.
Cheers,
Mark
Index: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- java/net/URLStreamHandler.java 5 May 2004 08:51:04 -0000 1.29
+++ java/net/URLStreamHandler.java 6 Jul 2004 16:27:26 -0000 1.30
@@ -131,8 +131,12 @@
String query = null;
// On Windows we need to change \ to / for file URLs
- if (url.getProtocol().equals("file"))
- spec = spec.replace(File.separatorChar, '/');
+ char separator = File.separatorChar;
+ if (url.getProtocol().equals("file") && separator != '/')
+ {
+ file = file.replace(separator, '/');
+ spec = spec.replace(separator, '/');
+ }
if (spec.regionMatches(start, "//", 0, 2))
{
@@ -216,7 +220,7 @@
{
boolean endsWithSlash = file.charAt(file.length() - 1) == '/';
file = new File(file).getCanonicalPath();
- file = file.replace(File.separatorChar, '/');
+ file = file.replace(separator, '/');
if (endsWithSlash && file.charAt(file.length() - 1) != '/')
file += '/';
}
signature.asc
Description: This is a digitally signed message part