2004-11-18 Jeroen Frijters <jeroen@frijters.net>
authorJeroen Frijters <jeroen@frijters.net>
Thu, 18 Nov 2004 20:24:33 +0000 (20:24 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Thu, 18 Nov 2004 20:24:33 +0000 (20:24 +0000)
* java/net/URLStreamHandler.java
(parseURL): Fixed file path canonicalisation.

From-SVN: r90880

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

index d565ec042034d28a471e22b272cc32e1e29385ad..6aeddd60733fcd731f6cb71d2310664888ca53c8 100644 (file)
@@ -3,6 +3,11 @@
        * java/net/URLStreamHandler.java
        (parseURL): Fixed file path canonicalisation.
 
+2004-11-18  Jeroen Frijters  <jeroen@frijters.net>
+
+       * java/net/URLStreamHandler.java
+       (parseURL): Fixed file path canonicalisation.
+
 2004-11-18  Michael Koch  <konqueror@gmx.de>
 
        * java/net/URLClassLoader.java: Whitespace cleanup.
index 2e91eb64014d9a853edaff82563d9c0e0f5be4b7..fbe863f24c0ea1ca14c8097a1ac929544df27da1 100644 (file)
@@ -214,23 +214,9 @@ public abstract class URLStreamHandler
          file = (file.substring(0, lastSlash)
                  + '/' + spec.substring(start, end));
 
-       if (url.getProtocol().equals("file"))
-         {
-           // For "file" URLs constructed relative to a context, we
-           // need to canonicalise the file path.
-           try
-             {
-               boolean endsWithSlash = file.charAt(file.length() - 1) == '/';
-               file = new File(file).getCanonicalPath();
-               file = file.replace(separator, '/');
-               if (endsWithSlash && file.charAt(file.length() - 1) != '/')
-                 file += '/';
-             }
-           catch (IOException e)
-             {
-               // Do nothing.
-             }
-         }
+       // For URLs constructed relative to a context, we
+       // need to canonicalise the file path.
+       file = canonicalizeFilename(file);
 
        ref = null;
       }