-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2_12, 5.0
-
b08
-
generic, x86
-
generic, windows_2000, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2121228 | 5.0u2 | Michael McMahon | P3 | Resolved | Fixed | b03 |
JDK-2146440 | 1.4.2_15 | Sean Coffey | P3 | Closed | Cannot Reproduce |
Name: rmT116609 Date: 09/16/2004
FULL PRODUCT VERSION :
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
getResourceAsStream is broken in JDK1.5.0-rc
In versions of Java up to and including JDK1.5.0-beta2 Class.getResourceAsStream(String aName) was returning the Resource as specified in the documentation.
It says aName starting with / it is unchanged.
Now any resources that require Web Address escape codes (%'s) can not be loaded from a jar in this way.
Even some legal java identifiers don't work anymore such as TestM-^OÀ».class
(The compatibility issues note that only binary names for some methods can be used now, so I thought this might be the case, but this implies otherwise).
The method is also very inefficient as not just does it get the resource as it should, but then it makes a garbage URL with the % signs in it and does the security checks for a 2nd time and tries to get the Resource for a 2nd time from the garbage URL and then returns null.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
put the class in a jar
run the class with the jar in its classpath
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Resource Found to be displayed
ACTUAL -
Resource Not Found is displayed
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Test case using pound symbol:
public class TestÃú {
public static void main(String[] args) {
System.out.println(TestÃú.class.getResourceAsStream("/TestÃú.class") == null ?
"Resource Not Found" : "Resource Found");
}
}
Test case using unicode for the pound symbol:
public class Test\u00a3 {
public static void main(String[] args) {
System.out.println(Test\u00a3.class.getResourceAsStream("/Test\u00a3.class") == null ?
"Resource Not Found" : "Resource Found");
}
}
---------- END SOURCE ----------
Release Regression From : tiger-beta2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 302077)
======================================================================
###@###.### 10/8/04 16:17 GMT
FULL PRODUCT VERSION :
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
getResourceAsStream is broken in JDK1.5.0-rc
In versions of Java up to and including JDK1.5.0-beta2 Class.getResourceAsStream(String aName) was returning the Resource as specified in the documentation.
It says aName starting with / it is unchanged.
Now any resources that require Web Address escape codes (%'s) can not be loaded from a jar in this way.
Even some legal java identifiers don't work anymore such as TestM-^OÀ».class
(The compatibility issues note that only binary names for some methods can be used now, so I thought this might be the case, but this implies otherwise).
The method is also very inefficient as not just does it get the resource as it should, but then it makes a garbage URL with the % signs in it and does the security checks for a 2nd time and tries to get the Resource for a 2nd time from the garbage URL and then returns null.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
put the class in a jar
run the class with the jar in its classpath
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Resource Found to be displayed
ACTUAL -
Resource Not Found is displayed
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Test case using pound symbol:
public class TestÃú {
public static void main(String[] args) {
System.out.println(TestÃú.class.getResourceAsStream("/TestÃú.class") == null ?
"Resource Not Found" : "Resource Found");
}
}
Test case using unicode for the pound symbol:
public class Test\u00a3 {
public static void main(String[] args) {
System.out.println(Test\u00a3.class.getResourceAsStream("/Test\u00a3.class") == null ?
"Resource Not Found" : "Resource Found");
}
}
---------- END SOURCE ----------
Release Regression From : tiger-beta2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 302077)
======================================================================
###@###.### 10/8/04 16:17 GMT
- backported by
-
JDK-2121228 REGRESSION: getResourceAsStream is broken in JDK1.5.0-rc
-
- Resolved
-
-
JDK-2146440 REGRESSION: getResourceAsStream is broken in JDK1.5.0-rc
-
- Closed
-
- duplicates
-
JDK-6176415 REGRESSION: Resources with spaces in their names are not found in JAR files
-
- Closed
-