Bug 256128 URIUtil.makeAbsolute needs an additional check for a URI that's already absolute
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
index f8e9016..6db23ab 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
@@ -41,6 +41,7 @@
suite.addTest(ProgressMonitorWrapperTest.suite());
suite.addTest(QualifiedNameTest.suite());
suite.addTest(StatusTest.suite());
+ suite.addTest(URIUtilTest.suite());
suite.addTest(URLTest.suite());
return suite;
}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URIUtilTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URIUtilTest.java
index 1b73ec1..7c50818 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URIUtilTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/URIUtilTest.java
@@ -12,6 +12,8 @@
import java.io.File;
import java.net.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
import org.eclipse.core.runtime.URIUtil;
/**
@@ -23,6 +25,10 @@
private static final String[] testPaths = new String[] {"abc", "with spaces", "with%percent"};
+ public static Test suite() {
+ return new TestSuite(URIUtilTest.class);
+ }
+
/**
* Tests for {@link URLUtil#toFile(URL)}.
*/
@@ -221,7 +227,12 @@
new URI[] {new URI("file:/a/b"), new URI("http:/foo.com/a/x"), new URI("file:/a/b")}, //
//
new URI[] {new URI("../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/eclipse/plugins/foo.jar")}, //
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/eclipse/plugins/foo.jar")}, //
+ //cases that can't be made absolute
+ //different scheme
+ new URI[] {new URI("file:../plugins/foo.jar"), new URI("http:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
+ //already absolute
+ new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
+ new URI[] {new URI("file:/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/foo.jar")}, //
};
for (int i = 0; i < data.length; i++) {
@@ -251,10 +262,12 @@
new URI[] {new URI("b"), new URI("file:/C:/a/"), new URI("file:/C:/a/b")}, //
new URI[] {new URI("b"), new URI("file:/C:/a"), new URI("file:/C:/a/b")}, //
new URI[] {new URI("file:/c:/"), new URI("file:/d:/"), new URI("file:/c:/")}, //
+ new URI[] {new URI("/c:/a/b/c"), new URI("file:/d:/a/b/"), new URI("file:/c:/a/b/c")}, //
new URI[] {new URI(""), new URI("file:/c:/"), new URI("file:/c:/")}, //
//
new URI[] {new URI("../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
+ //already absolute
+ new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
};
for (int i = 0; i < data.length; i++) {
URI location = data[i][0];