This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: FYI: fix File.toURL bug


I'm checking this in.  File.toURL didn't comply with the spec.  This
patch fixes it.

URL still transforms the URL from `file:///tmp/foo' to `file:/tmp/foo'.
That's too bad (my reading of the URL RFC is that the former is correct).
I'm not planning to look into that.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/io/File.java (toURL): Use getAbsolutePath and `file://'.

Index: java/io/File.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/File.java,v
retrieving revision 1.20
diff -u -r1.20 File.java
--- java/io/File.java 2001/08/31 22:31:40 1.20
+++ java/io/File.java 2001/09/12 04:27:04
@@ -281,7 +281,8 @@
 
   public URL toURL () throws MalformedURLException
   {
-    return new URL ("file:" + path + (isDirectory() ? "/" : ""));
+    return new URL ("file://" + getAbsolutePath ()
+		    + (isDirectory() ? "/" : ""));
   }
 
   private final native boolean performMkdir ();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]