codeLocationFromPath breaks for paths with spaces

Description

I discovered this in the Guice examples, but it's not a problem limited to Guice. Take this code that searches for stories:

new StoryFinder().findPaths( CodeLocations.codeLocationFromPath( "resources" ).getFile(), asList( "*/.story" ), null );

If the "resources" folder resides in a base path that contains a space, the StoryFinder will fail to locate the stories. This is because codeLocationFromPath() uses a java.net.URL object under-the-hood to URL encode the path, converting spaces to %20. Thus, jBehave will look here:

c:\jbehave\folder%20with%20spaces\resources

for stories located here:

c:\jbehave\folder with spaces\resources

This is also a problem for reports. If relative paths are used in any form, when jBehave converts them to full paths, the paths are URL-encoded. This in turn causes our Hudson builds to fail because it cannot locate the reports.

The workaround for this is to not use CodeLocations to locate stories, and to use a Hudson project with no spaces, but jBehave really should support paths with spaces. This occurs on both Windows and Linux.

Assignee

Unassigned

Reporter

Ryan Nelson

Labels

Components

Fix versions

Affects versions

Priority

Minor
Configure