Exception in thread "main" java.lang.IllegalArgumentException: URI has an authority component
caused by code:
File f = new File ("//SERVER/MyDocuments/USER/DIR/");
new File (f.toURI().toURL().toURI()); /* file://SERVER/MyDocuments/USER/DIR */
but following code is OK:
new File (f.toURI()); /* file:////SERVER/MyDocuments/USER/DIR */
Its fragile, not mentioning that URI.normalize () complicates it even more (file:/SERVER/MyDocuments/USER/DIR)
After investigation, I think problem falls into 2 categories:
One is URI.normalize() is removing too many slashes, as bug 4723726 says.
The other is for any URI u, following identities not hold -
The buggy code may be java.net.URLStreamHandler.parseURL().
Anyway, UNC name is just used in windows. Is it safe to slightly adjust class URL's behavior to fix this bug?
###@###.### 2004-11-29 10:48:57 GMT