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]
Other format: [Raw text]

Patch: FYI: PR 4481 fix


I'm checking this in.  It fixes PR 4481 plus another java.io.File bug.
It is POSIX-specific, but then so are other parts of File.

Tom

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

	Fix for PR libgcj/4481:
	* java/io/File.java (getParent): Handle case where path is "/".
	(normalizePath): Use correct string for UNC leader.

Index: java/io/File.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/File.java,v
retrieving revision 1.22
diff -u -r1.22 File.java
--- java/io/File.java 2001/09/13 23:18:06 1.22
+++ java/io/File.java 2001/10/08 20:40:00
@@ -84,9 +84,9 @@
   {
     int dupIndex = p.indexOf(dupSeparator);
     int plen = p.length();
-    
+
     // Special case: permit Windows UNC path prefix.
-    if (dupSeparator.equals("\\") && dupIndex == 0)
+    if (dupSeparator.equals("\\\\") && dupIndex == 0)
       dupIndex = p.indexOf(dupSeparator, 1);
 
     if (dupIndex == -1)
@@ -181,6 +181,9 @@
     int last = path.lastIndexOf(separatorChar);
     if (last == -1)
       return null;
+    // FIXME: POSIX assumption.
+    if (last == 0 && path.charAt (0) == '/')
+      ++last;
     return path.substring(0, last);
   }
 


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