This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: PR 4481 fix
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Subject: Patch: FYI: PR 4481 fix
- From: Tom Tromey <tromey at redhat dot com>
- Date: 08 Oct 2001 14:55:52 -0600
- Reply-To: tromey at redhat dot com
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);
}