Bug 283297 Installation path containing square brackets prevents eclipse startup
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 d03028a..aef3c50 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
@@ -221,6 +221,31 @@
}
/**
+ * Tests handling of conversion from a File with spaces to URL and File to URI and equivalence of the resulting URI
+ */
+ public void testFileWithBrackets() throws MalformedURLException, URISyntaxException {
+ File fileWithSpaces = new File("/c:/with[brackets]/goo");
+ URI correctURI = fileWithSpaces.toURI();
+ URL fileURL = fileWithSpaces.toURL();
+ URI fileURI = null;
+ try {
+ fileURI = fileURL.toURI();
+ fail();
+ } catch (URISyntaxException e) {
+ fileURI = URIUtil.toURI(fileURL);
+ }
+ assertEquals("1.1", correctURI, fileURI);
+
+ try {
+ fileURI = new URI(fileURL.toString());
+ fail();
+ } catch (URISyntaxException e) {
+ fileURI = URIUtil.fromString(fileURL.toString());
+ }
+ assertEquals("1.2", correctURI, fileURI);
+ }
+
+ /**
* Tests for {@link URIUtil#append(URI, String)}.
* @throws URISyntaxException
*/