worldimage reader fails when there are spaces in the path
---------------------------------------------------------

         Key: GEOT-779
         URL: http://jira.codehaus.org/browse/GEOT-779
     Project: GeoTools
        Type: Bug
  Components: image datasource  
    Versions: 2.2.M2    
 Environment: windows xp - java 1.4
    Reporter: Ian Turton
 Assigned to: Richard Gould 
    Priority: Critical


If your path has spaces in it then the worldimagereader tests fail as they can 
not find the data file. This is caused by over zelous handling of file urls - 
(probably as an optimisation) urls with a file protocol are converted to files. 
This conversion breaks when there are encoded spaces in the url as %20 does not 
get converted back to a space. 

The simple fix is to remove the optimising code in 
WorldImageReader.readSourceImage
//            if (((URL) source).getProtocol() == "file") {
//                RandomAccessFile rFile = new RandomAccessFile(((URL) source)
//                        .getFile(), "r");
//                channel = rFile.getChannel();
//                stream = new FileChannelImageInputStream(channel);
//            } else {

and in the constructor
//            if (((URL) source).getProtocol().compareToIgnoreCase("file") == 
0) {
//                this.source = new File(((URL) source).getPath());
//            }

This fixes the problem on my machine. 

I guess the longer fix would be to revisit the decoding of the url to a file 
name.

-- 
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



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to