Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6794193

Regression in loading images under WebStart 5.0_17

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2003

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                coffeys Sean Coffey
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: