Details
-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
None
Description
In the following example, enabling the Multi-Release jar feature causes the URI to a directory in the jar to change. With Multi-Release jars enabled, the URI has a trailing `/`.
I expected the URIs to be the same regardless of whether the jar was a multi-release jar.
```
package foo;
import java.net.URL;
public class MrJarTest {
public static void main(String[] args) throws Exception {
Class<?> clazz = MrJarTest.class;
String path = "/" + clazz.getPackage().getName().replace('.', '/');
URL url = clazz.getResource(path);
System.err.println(url.toURI());
}
}
```
javac foo/MrJarTest.java
jar cf lib.jar foo/ foo/*
java -cp lib.jar foo.MrJarTest
...
jar:file:/tmp/tmp.q7KDUcld9Q/lib.jar!/foo
jar cf lib.jar foo/ foo/* --release 9 foo/*
java -cp lib.jar foo.MrJarTest
...
jar:file:/tmp/tmp.q7KDUcld9Q/lib.jar!/foo/
I expected the URIs to be the same regardless of whether the jar was a multi-release jar.
```
package foo;
import java.net.URL;
public class MrJarTest {
public static void main(String[] args) throws Exception {
Class<?> clazz = MrJarTest.class;
String path = "/" + clazz.getPackage().getName().replace('.', '/');
URL url = clazz.getResource(path);
System.err.println(url.toURI());
}
}
```
javac foo/MrJarTest.java
jar cf lib.jar foo/ foo/*
java -cp lib.jar foo.MrJarTest
...
jar:file:/tmp/tmp.q7KDUcld9Q/lib.jar!/foo
jar cf lib.jar foo/ foo/* --release 9 foo/*
java -cp lib.jar foo.MrJarTest
...
jar:file:/tmp/tmp.q7KDUcld9Q/lib.jar!/foo/