This is the mail archive of the java-patches@sourceware.cygnus.com 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: java.io.File StringOutOfBoundsException


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)

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