United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6519337 : Regression: getResourceAsStream cannot access a resource inside a jar file that has spaces in path

Details
Type:
Bug
Submit Date:
2007-01-30
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2007-05-21
Component:
core-libs
OS:
generic,solaris_10
Sub-Component:
java.net
CPU:
x86,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_12,1.4.2_13
Fixed Versions:
1.4.2_15 (b02)

Related Reports
Backport:
Duplicate:
Relates:
Relates:

Sub Tasks

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
EVALUATION

Looks like this is a duplicate of 5103449
                                     
2007-01-31
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
SUGGESTED FIX

for reference - the final fix was : 

http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=2140
                                     
2008-09-16



Hardware and Software, Engineered to Work Together