JDK-6794193 : Regression in loading images under WebStart 5.0_17
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 5.0u17
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2003
  • CPU: x86
  • Submitted: 2009-01-15
  • Updated: 2011-02-16
  • Resolved: 2010-04-08
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
5.0u25Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 5.2.3790]

A DESCRIPTION OF THE PROBLEM :
We are using the following code to load images as ImageIcons:

new ImageIcon(new URL(base, relative))

Prior to 5.0_16 this was working under WebStart, with the URL pointing to the jar resource in the local WebStart cache, along the lines of

c:\documents and settings\owner\Application Data\Sun\Java\Deployment\cache\javaws\http\Dmymachine\P7001\V1_0_0\DMfolder\DMapp\RMmyjar.jar!/path/to/my/image.gif

In 5.0_16 this was broken with 6746185. In 5.0_17 the URL is along the lines of

http://mymachine:7001/folder/app/myjar.jar!/path/to/my/image.gif

However, new ImageIcon() fails to load the image when passed this URL. It looks like the internal ToolkitImage class cannot load images from such URLs.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar that has the following:
* dummy.txt on the root level
* Frame class that loads an image with new ImageIcon(new URL(MyClass.class.getResource("dummy.txt"), "myimage.gif")) and displays this on the content pane
* Simple myimage.gif

Sign this jar and deploy via WebStart
Run the JNLP



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Image is loaded and displayed on the main frame
ACTUAL -
Image is not loaded properly. ImageIcon.img is not null, but its width and height are -1

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Ugly workaround:

If the IconImage.img has -1 width and height:

* Inspect the URL
* If it has !/, extract the trailing part
* Use the class loader of the current class and its getResource to create another URL to that image
* Use ImageIO.read to load the image from that URL (note - new ImageIcon will *not* work with that URL)
* Use new ImageIcon(Image) to create and ImageIcon from that image.

While this works, it is completely unnecessary and should not have been broken.

Release Regression From : 5.0u16
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Closing as a duplicate of 6767754
08-04-2010

EVALUATION We can fix this issue by implementing the fix for CR 6767754 which is underway. will close as a duplicate once I have confirmation
09-02-2009