Ste
Ste

Reputation: 419

AbstractFileName trying to create invalid URI

DISCLAIMER: I could not find an easy way to file a bug directly to the project issue tracker, thus posting here in the hope somebody can do it.

The problem: the following code

FileSystemManager mgr = VFS.getManager();
FileObject f = mgr.resolveFile("file://filewith}.txt");
System.out.println(f.getURI());

throws an expection when trying to create the URI:

at java.base/java.net.URI.create(URI.java:903)
at org.apache.commons.vfs2.FileObject.getURI(FileObject.java:310)
...

The offending character is '}', which I recognize is not mentioned in the JDK documentation as not valid in a URI, but still URI.create() fails. Looking at the code. the fix should be pretty easy: just add '{' and '}' to RESERVED_URI_CHARS.

Upvotes: 0

Views: 25

Answers (0)

Related Questions