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: fix PR 25389


I'm checking this in to Classpath and libgcj 4.1 and trunk.

This fixes PR 25389, which was discovered by OO.o.  We were throwing
an NPE when we saw a non-hierarchical URI in the File constructor.
Instead we should be throwing an IllegalArgumentException.

I've updated the Mauve test to reflect this.

Tom

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

	PR classpath/25389:
	* java/io/File.java (File): Throw IllegalArgumentException if URI is
	non-hierarchical.

Index: java/io/File.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/File.java,v
retrieving revision 1.59
diff -u -r1.59 File.java
--- java/io/File.java	6 Nov 2005 20:28:00 -0000	1.59
+++ java/io/File.java	14 Dec 2005 17:28:28 -0000
@@ -406,7 +406,11 @@
     if (!uri.getScheme().equals("file"))
 	throw new IllegalArgumentException("invalid uri protocol");
 
-    path = normalizePath(uri.getPath());
+    String name = uri.getPath();
+    if (name == null)
+      throw new IllegalArgumentException("URI \"" + uri
+                     + "\" is not hierarchical");
+    path = normalizePath(name);
   }
 
   /**


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