[Patch] java/net/URLStreamHandler

Michael Koch konqueror@gmx.de
Thu Nov 18 22:06:00 GMT 2004


Hi list,


I just commited the attached patch to merge it from GNU classpath.


Michael


2004-11-18  Jeroen Frijters  <jeroen@frijters.net>

	* java/net/URLStreamHandler.java
	(parseURL): Fixed file path canonicalisation.

-------------- next part --------------
Index: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v
retrieving revision 1.32
diff -u -r1.32 URLStreamHandler.java
--- java/net/URLStreamHandler.java	17 Oct 2004 08:29:57 -0000	1.32
+++ java/net/URLStreamHandler.java	18 Nov 2004 19:41:29 -0000
@@ -214,23 +214,9 @@
 	  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;
       }


More information about the Java-patches mailing list