DataUtilities.urlToFile doesn't handle network paths correctly
--------------------------------------------------------------

                 Key: GEOT-3300
                 URL: http://jira.codehaus.org/browse/GEOT-3300
             Project: GeoTools
          Issue Type: Bug
          Components: data
    Affects Versions: 2.6.5
            Reporter: Patrick Nagelschmidt
            Priority: Minor


Currently in uDig you can open a map from a windows network share (samba) 
without problems, but if you save and re-open the project again the path is 
treated as local and the file not found. The culprit seems to be 
{{org.geotools.data.DataUtilities.urlToFile}}.

If you create an URL object containing a windows network share like this
{noformat}
new URL("file", "////oehhwsfs09", "/some/path/on/the/server/filename.nds");
{noformat}
and pass it to {{org.geotools.data.DataUtilities.urlToFile(URL)}}, as it's done 
automatically if e.g. uDig saves a project, the {{URL}} object will be 
transformed into a plain string and that will be passed to the {{File}} 
constructor. This works, i.e. the file can be opened, but from that point on 
the file's network nature is lost, which means the filesystem normalizer of 
{{Java.io.File}} will remove the leading double slashes and threat the file as 
local. Imo you should call {{Java.io.File(URI)}} instead of 
{{Java.io.File(String)}} at the end of {{urlToFile}} to make sure a set 
authority field in the {{URL}} is preserved.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to