Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] There and back again (FIle to URL to URI to URL to File)

Sigh ...

The URL that is passed into createService:
- file:/C:/Documents and Settings/jgarnett/Desktop/data/earthimages.xml

The URL that is understood by Firefox:
- file:///C:/Documents%20and%20Settings/jgarnett/Desktop/data/earthimages.xml

For starters:
try {
  return url.toURI(); // blocks (of course)
}
catch (URISyntaxException e){
  e.printStackTrace();
}

Produces the following:
java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/jgarnett/Desktop/data/earthimages.xml
(So we need to encode the spaces, and Java file.toURL() did not do this? Apparently not ... )
http://forum.java.sun.com/thread.jspa?threadID=776791&messageID=4422228

GeoTools code uses a java.net.URLDecoder to handle this sort of thing ... will see what I can do.
Jody



Back to the top