This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/25389] File(new URI("file:./")) -> java.lang.NullPointerException
- From: "mark at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 13 Dec 2005 11:46:26 -0000
- Subject: [Bug java/25389] File(new URI("file:./")) -> java.lang.NullPointerException
- References: <bug-25389-8961@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from mark at gcc dot gnu dot org 2005-12-13 11:46 -------
Confirmed. URI.getPath() may return null and we don't check for that in the
File(URI) constructor. A simple fix might be:
diff -u -r1.59 File.java
--- java/io/File.java 6 Nov 2005 20:28:00 -0000 1.59
+++ java/io/File.java 13 Dec 2005 11:37:26 -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)
+ name = "";
+
+ path = normalizePath(name);
}
/**
Note that java/io/File.java is not fully merged between classpath and libgcj.
--
mark at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-12-13 11:46:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25389