worldimage reader fails when there are spaces in the path

Description

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.

Environment

None

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Fix versions

Affects versions

Priority

High
Configure