OSDN Git Service

* java/net/URLStreamHandler.java (parseURL): Canonicalize
authormembar <membar@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jul 2004 16:27:26 +0000 (16:27 +0000)
committermembar <membar@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jul 2004 16:27:26 +0000 (16:27 +0000)
file portion of URL in addition to spec for file: protocol.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84157 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/net/URLStreamHandler.java

index 66f3f41..8299b73 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-06  Mohan Embar  <gnustuff@thisiscool.com>
+
+       * java/net/URLStreamHandler.java (parseURL): Canonicalize
+       file portion of URL in addition to spec for file: protocol.
+
 2004-07-05  Anthony Green  <green@redhat.com>
        
        * java/io/File.java (toURI): Merge from Classpath.
index d224ff5..5fef7ea 100644 (file)
@@ -1,5 +1,5 @@
 /* URLStreamHandler.java -- Abstract superclass for all protocol handlers
-   Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -131,8 +131,12 @@ public abstract class URLStreamHandler
     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 @@ public abstract class URLStreamHandler
              {
                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 += '/';
              }