OSDN Git Service

Fix for PR libgcj/4481:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Oct 2001 20:42:13 +0000 (20:42 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Oct 2001 20:42:13 +0000 (20:42 +0000)
* java/io/File.java (getParent): Handle case where path is "/".
(normalizePath): Use correct string for UNC leader.

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

libjava/ChangeLog
libjava/java/io/File.java

index b79cb49..af67c16 100644 (file)
@@ -1,3 +1,9 @@
+2001-10-08  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.
+
 2001-10-06  Mark Wielaard  <mark@klomp.org>
 
        * java/io/BufferedInputStream.java: Merge with Classpath
index 858f2b3..a268278 100644 (file)
@@ -84,9 +84,9 @@ public class File implements Serializable, Comparable
   {
     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 @@ public class File implements Serializable, Comparable
     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);
   }