This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: java.io.File StringOutOfBoundsException
- To: java-patches at sourceware dot cygnus dot com
- Subject: Patch: java.io.File StringOutOfBoundsException
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Sun, 27 Feb 2000 23:41:10 +1300
The (String, String) constructor to java.io.File would throw a
StringIndexOutOfBoundsException if the empty string was passed as the
first argument.
I'm commiting this trivial patch.
[ bryce ]
2000-02-27 Bryce McKinlay <bryce@albatross.co.nz>
* java/io/File.java (File(String, String)): For dirPath, treat an
empty String the same as `null'.
Index: java/io/File.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/io/File.java,v
retrieving revision 1.7
diff -u -r1.7 File.java
--- File.java 2000/02/12 20:13:42 1.7
+++ File.java 2000/02/27 10:40:08
@@ -79,7 +79,7 @@
{
if (name == null)
throw new NullPointerException ();
- if (dirPath != null)
+ if (dirPath != null && dirPath.length() > 0)
{
// Try to be smart about the number of separator characters.
if (dirPath.charAt(dirPath.length() - 1) == separatorChar)