[Bug classpath/25389] File(new URI("file:./")) -> java.lang.NullPointerException

mark at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Dec 13 22:01:00 GMT 2005

------- Comment #4 from mark at gcc dot gnu dot org  2005-12-13 22:01 -------
(In reply to comment #3)
> Exception in thread "main" java.lang.IllegalArgumentException: URI is not
> hierarchical
>         at java.io.File.<init>(File.java:344)
>         at myfirstprog.main(myfirstprog.java:16)

Interesting. That is a bit lame. But seems legal since the uri scheme isn't
followed by a double slash so it is indeed not hierarchical.

But since we are constructing such URLs/URIs ourselves (for example in the
SystemClassLoader) through new URL("file", "", -1, "./") it seems wise to
handle them explicitly in the File(URI) constructor.



More information about the Java-prs mailing list