-
Bug
-
Resolution: Unresolved
-
P4
-
6u10, 18
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I have a resource file (named resource.txt) that is located in 2 jar files (jar1.jar and mainJar.jar).
mainJar.jar depends on jar1.jar (I have a classpath entry in the manifest).
When I try to load the resource from mainJar using ClassLoader.getResources() I get 2 results => GOOD
Now I generate the INDEX.LIST using jar -i mainJar.jar.
Running the same test again, I now have only 1 result => BAD
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create 2 JARs with the given index in the main JAR:
JarIndex-Version: 1.0
mainJarWithIndex.jar
Main.class
resource.txt
jar1.jar
resource.txt
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Resource found = 2
ACTUAL -
Resource found = 1
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main {
public static void main(String[] args) throws IOException {
Enumeration<URL> e = Main.class.getClassLoader().getResources("resource.txt");
int count = 0;
while (e.hasMoreElements()) {
URL u = e.nextElement();
count ++;
}
System.out.println("Resource found = " + count);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not generate INDEX.LIST but it will produce bad performances when using webstart or applet.
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I have a resource file (named resource.txt) that is located in 2 jar files (jar1.jar and mainJar.jar).
mainJar.jar depends on jar1.jar (I have a classpath entry in the manifest).
When I try to load the resource from mainJar using ClassLoader.getResources() I get 2 results => GOOD
Now I generate the INDEX.LIST using jar -i mainJar.jar.
Running the same test again, I now have only 1 result => BAD
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create 2 JARs with the given index in the main JAR:
JarIndex-Version: 1.0
mainJarWithIndex.jar
Main.class
resource.txt
jar1.jar
resource.txt
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Resource found = 2
ACTUAL -
Resource found = 1
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main {
public static void main(String[] args) throws IOException {
Enumeration<URL> e = Main.class.getClassLoader().getResources("resource.txt");
int count = 0;
while (e.hasMoreElements()) {
URL u = e.nextElement();
count ++;
}
System.out.println("Resource found = " + count);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not generate INDEX.LIST but it will produce bad performances when using webstart or applet.
- relates to
-
JDK-8273401 Disable JarIndex Support In URLClassPath
-
- Resolved
-
-
JDK-8302819 Remove JAR Index
-
- Resolved
-
- links to
-
Review openjdk/jdk/5316