Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2006-11-15 14:13:48 -0500
committerThomas Watson2006-11-15 14:13:48 -0500
commit0ba91a660781085fca0c5c2e0d91a87ef2ae7abb (patch)
tree1a537e7f1597800863f7d26116ed999667c57c20
parent53a442da9be1ce60d1443e1b3d23b44e547eeb6d (diff)
downloadrt.equinox.framework-0ba91a660781085fca0c5c2e0d91a87ef2ae7abb.tar.gz
rt.equinox.framework-0ba91a660781085fca0c5c2e0d91a87ef2ae7abb.tar.xz
rt.equinox.framework-0ba91a660781085fca0c5c2e0d91a87ef2ae7abb.zip
Bug 164077 bundleresouce: URL treats ".." and "../" differently while resolving relative URI
-rw-r--r--bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/test/a/b/c/d0
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java51
3 files changed, 52 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
index 90a799b80..e6987cbb7 100644
--- a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Core OSGi Tests
Bundle-SymbolicName: org.eclipse.osgi.tests
-Bundle-Version: 3.1.0
+Bundle-Version: 3.3.0
Bundle-ClassPath: osgitests.jar
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test/a/b/c/d b/bundles/org.eclipse.osgi.tests/bundles_src/test/a/b/c/d
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/test/a/b/c/d
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java
index 8599b7807..f71f4180c 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.tests.bundles;
+import java.net.URL;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.osgi.tests.OSGiTestsActivator;
@@ -437,4 +438,54 @@ public class ClassLoadingBundleTests extends AbstractBundleTests {
compareResults(expectedEvents, actualEvents);
}
+
+ public void testURLsBug164077() throws Exception {
+ Bundle test = installer.installBundle("test");
+ installer.resolveBundles(new Bundle[] {test});
+ URL[] urls = new URL[2];
+ urls[0] = test.getResource("a/b/c/d");
+ urls[1] = test.getEntry("a/b/c/d");
+ assertNotNull("resource", urls[0]);
+ assertNotNull("entry", urls[1]);
+ for (int i = 0; i < urls.length; i++) {
+ URL testURL = new URL(urls[i], "g");
+ assertEquals("g", "/a/b/c/g", testURL.getPath());
+ testURL = new URL(urls[i], "./g");
+ assertEquals("./g", "/a/b/c/g", testURL.getPath());
+ testURL = new URL(urls[i], "g/");
+ assertEquals("g/", "/a/b/c/g/", testURL.getPath());
+ testURL = new URL(urls[i], "/g");
+ assertEquals("/g", "/g", testURL.getPath());
+ testURL = new URL(urls[i], "?y");
+ assertEquals("?y", "/a/b/c/?y", testURL.getPath());
+ testURL = new URL(urls[i], "g?y");
+ assertEquals("g?y", "/a/b/c/g?y", testURL.getPath());
+ testURL = new URL(urls[i], "g#s");
+ assertEquals("g#s", "/a/b/c/g#s", testURL.getPath() + "#s");
+ testURL = new URL(urls[i], "g?y#s");
+ assertEquals("g?y#s", "/a/b/c/g?y#s", testURL.getPath() + "#s");
+ testURL = new URL(urls[i], ";x");
+ assertEquals(";x", "/a/b/c/;x", testURL.getPath());
+ testURL = new URL(urls[i], "g;x");
+ assertEquals("g;x", "/a/b/c/g;x", testURL.getPath());
+ testURL = new URL(urls[i], "g;x?y#s");
+ assertEquals("g;x?y#s", "/a/b/c/g;x?y#s", testURL.getPath() + "#s");
+ testURL = new URL(urls[i], ".");
+ assertEquals(".", "/a/b/c/", testURL.getPath());
+ testURL = new URL(urls[i], "./");
+ assertEquals("./", "/a/b/c/", testURL.getPath());
+ testURL = new URL(urls[i], "..");
+ assertEquals("..", "/a/b/", testURL.getPath());
+ testURL = new URL(urls[i], "../");
+ assertEquals("../", "/a/b/", testURL.getPath());
+ testURL = new URL(urls[i], "../g");
+ assertEquals("../g", "/a/b/g", testURL.getPath());
+ testURL = new URL(urls[i], "../..");
+ assertEquals("../..", "/a/", testURL.getPath());
+ testURL = new URL(urls[i], "../../");
+ assertEquals("../../", "/a/", testURL.getPath());
+ testURL = new URL(urls[i], "../../g");
+ assertEquals("../../g", "/a/g", testURL.getPath());
+ }
+ }
}

Back to the top