You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "Gregor J. Rothfuss" <gr...@apache.org> on 2005/05/09 02:15:45 UTC

careful with the default URI constructor

we had some code like this:

directory = new File(new URI(source.getURI()));

which has caused trouble with spaces in paths for a long time.

java.net.URI says:

http://java.sun.com/j2se/1.4.2/docs/api/java/net/URI.html#URI(java.lang.String)

"The single-argument constructor requires any illegal characters in its 
argument to be quoted and preserves any escaped octets and other 
characters that are present."

thus, you need to use:

directory = new File(new URI(NetUtils.encodePath(source.getURI())));


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org