From 5b90e13d79c97a42f5a842806df0a222774f5336 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 10 May 2010 00:04:12 +0000 Subject: [PATCH] The previous fix for Linux broke the tests on Windows. This time it's a cross-platform fix. --- .../cdt/internal/index/tests/IndexLocationTest.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java index e2b7ded4460..25c58127387 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java @@ -14,6 +14,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -146,8 +147,7 @@ public class IndexLocationTest extends BaseTestCase { ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(cproject.getProject().getName()+"/source.cpp")).getFullPath(), new Path(nms3[0].getFile().getLocation().getFullPath()) ); - } - finally { + } finally { index.releaseReadLock(); } } finally { @@ -291,7 +291,7 @@ public class IndexLocationTest extends BaseTestCase { "/"+cproject.getProject().getName()+"/a /b /c.d", "/"+cproject.getProject().getName()+"/a b c/d-e/f.g" }; - URI base = URI.create("file://" + basePath); + URI base = makeDirectoryURI(basePath); URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base); // loc -project-> raw -uri-> loc for (int i= 0; i < paths.length; i++) { @@ -329,7 +329,7 @@ public class IndexLocationTest extends BaseTestCase { linkedFolder.getFullPath()+"/a b c/d-e/f.g" }; // loc -project-> raw -uri-> loc - URI base = URI.create("file://" + basePath); + URI base = makeDirectoryURI(basePath); URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base); for (int i= 0; i < paths.length; i++) { IFile file= linkedFolder.getFile(paths[i]); @@ -357,4 +357,9 @@ public class IndexLocationTest extends BaseTestCase { fos.write(content.getBytes()); fos.close(); } + + private URI makeDirectoryURI(String dir) throws URISyntaxException { + URI uri = new File(dir).toURI(); + return new URI(uri.toString() + "/"); + } } \ No newline at end of file