JDK-5076633 : Missing slash on resource URLs with Java WebStart
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-07-21
  • Updated: 2005-02-06
  • Resolved: 2005-02-06
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.
JDK 6
6Resolved
Related Reports
Duplicate :  
Description

Name: gm110360			Date: 07/21/2004


FULL PRODUCT VERSION :
Java Web Start 1.4.2 Console, started Thu Jan 08 15:47:29 MST 2004
Java 2 Runtime Environment: Version 1.4.2_01 by Sun Microsystems Inc.

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
WebStart does not report a valid URL for resources.

Execute the following code:

System.out.println(getClass().getClassLoader().getResources("resourcename"));

When running this in 1.4.2_05 and J2se 5.0-beta2 from the command line you will get a URL that looks like this:

jar:file:/C:/myjar.jar!/resourcename

However, execute this same code when running inside WebStart and you get:

jar:file:C:/Documents%20and%20Settings/username/.javaws/cache/http/Dhost/Pport/RMmyjar.jar!/resourcename

Note the missing forward-slash after the protocol

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JAR with the class file and a sample test.txt resource file.
2. Execute this with command line java -jar resource.jar
3. Execute the same JAR under webstart using the sample JNLP file provided.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
jar:file:/C:/Documents%20and%20Settings/username/.javaws/cache/http/Dhost/Pport/RMmyjar.jar!/resourcename
ACTUAL -
jar:file:C:/Documents%20and%20Settings/username/.javaws/cache/http/Dhost/Pport/RMmyjar.jar!/resourcename

There is a missing slash after "file:"

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/*
 * ResourceLoader.java
 *
 * Created on July 21, 2004, 10:18 AM
 */

package examples.resource;

/**
 *
 * @author  gmanwani
 */
public class ResourceLoader {
    
    /** Creates a new instance of ResourceLoader */
    public ResourceLoader() {
        try {
            System.out.println(getClass().getClassLoader().getResource("examples/resource/test.txt"));
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ResourceLoader rl = new ResourceLoader();
        System.exit(0);
        // TODO code application logic here
    }
    
}

------ JNLP file --------
<jnlp spec="1.0" codebase="http://javaweb.sfbay.sun.com/~gmanwani">
   <information>
      <title>Test 1.0</title>
      <vendor>Sun Microsystems, Inc.</vendor>
   </information>
   <resources>
      <j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
      <jar href="resource.jar"/>
   </resources>
   <application-desc main-class="examples.resource.ResourceLoader"/>
</jnlp>
------ JNLP file end ---------
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Look for the missing forward-slash and add it back programatically.
(Incident Review ID: 233495) 
======================================================================

Comments
EVALUATION Both forms seem to work, so not a high priority, but should be consistant with stand alone. Will Look into for mustang. ###@###.### 2004-07-21 as a result of the fix to 4690736: Add Jar indexing to Java Web Start, and update JNLPClassLoader getResource will now return not a jar url to a file url into the cache, but a jar url of the actual url of the codebase, so this question is now moot. ###@###.### 2005-2-06 15:45:45 GMT
06-02-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
31-08-2004