Fix retrieval of test resources for paths containing spaces
commit3b06cee4bb5e03354453aecc7ac66a458c2ca743
authorJonas Fonseca <fonseca@diku.dk>
Wed, 22 Oct 2008 08:32:18 +0000 (22 10:32 +0200)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 22 Oct 2008 16:51:44 +0000 (22 18:51 +0200)
treedf5b85f7f583c82037b036e3dd682669cca2c2d8
parent0defd20133024c756dc580e46d5ea9fbd847c138
Fix retrieval of test resources for paths containing spaces

The use of URL.getPath() can be problematic when the repository path
contains spaces since they get encoded as %20, which will lead to a "No
such file" error when resolving to a local file. The fix first tries to
convert the resource URL to a URI (added in Java 1.5), which is then
used to construct the File instance. As a fallback use the old behavior
if a URISyntaxException is thrown.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java