Ensure that the site paths are resolved to their canonical form

This is important for running on Windows because it ensures among
other things that drive letters are converted to the standard case.
If this is not done Gerrit may fail with RepositoryNotFoundException
when opening a repository which actually exists.

Change-Id: I788f7dcc246956cfbdddfec00a3a2b6f92d4236f
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2011-11-23 10:15:30 +01:00
parent 81e52bc996
commit 6cc0abd4ca
2 changed files with 9 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ public class SitePathsTest extends TestCase {
}
}
public void testResolve() throws FileNotFoundException {
public void testResolve() throws IOException {
final File root = random();
final SitePaths site = new SitePaths(root);
@@ -84,11 +84,11 @@ public class SitePathsTest extends TestCase {
assertNull(site.resolve(""));
assertNotNull(site.resolve("a"));
assertEquals(new File(root, "a"), site.resolve("a"));
assertEquals(new File(root, "a").getCanonicalFile(), site.resolve("a"));
final String pfx = HostPlatform.isWin32() ? "C:/" : "/";
assertNotNull(site.resolve(pfx + "a"));
assertEquals(new File(pfx + "a"), site.resolve(pfx + "a"));
assertEquals(new File(pfx + "a").getCanonicalFile(), site.resolve(pfx + "a"));
}
private File random() {