JDK-6519337 : Regression: getResourceAsStream cannot access a resource inside a jar file that has spaces in path
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.4.2_12,1.4.2_13
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_10
  • CPU: generic,x86
  • Submitted: 2007-01-30
  • Updated: 2011-02-16
  • Resolved: 2007-05-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2_15 b02Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
With JDK1.4.2_12 and higher release, we are seeing some unique problem for getResourceAsStream method. The issue is if one has a resource inside a jar file has spaces in the path we cannot access that resource. As seen in the attached example I have tried two methods and both of them have failed to yield any results. I have attached source code and other required jar file for your testing.

(See attached files: TestClassLoader.class, TestClassLoader.java and test.jar)

Command to run the test

java -classpath .;test.jar TestClassLoader

This issue is not present with 1.4.2_11, 1.5.0_10 AND 1.6.0

Comments
SUGGESTED FIX for reference - the final fix was : http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=2140
2008-09-16

SUGGESTED FIX cobra1 $pwd /cobra/sean/1.4.2/j2se/src/share/classes/java/net cobra1 $sccs diffs JarURLConnection.java ------- JarURLConnection.java ------- 15a16 > import sun.net.www.ParseUtil; 162a164 > entryName = ParseUtil.decode (entryName); cobra1 $
2007-04-05

EVALUATION Re-opening this CR. Regression would seem to have occurred as a result of 4845728 fix. Several ParseUtil.encode statements are added. Without correct decoding in JarURLConnection class our testcase fails.
2007-04-05

EVALUATION Looks like this is a duplicate of 5103449
2007-01-31