JDK-4217080 : JEditor pane doesn't load images correctly from JARs
  • Type: Bug
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 1.1
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1999-03-04
  • Updated: 1999-03-12
  • Resolved: 1999-03-12
Related Reports
Duplicate :  
Description
JEditorPane does not load images from JAR files if the file that
references it contains a content attribute in a <META> tag.  For
example:

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Two interesting notes:

- If the image is first loaded and cached by a file that doesn't
  contain the <META> tag, it will subsequently load in a file that
  DOES contain the <META> tag.

- The same image is loaded correctly when the referencing file is
  loaded from the file system (as opposed to a JAR file).

I've attached a very simple JavaHelp HelpSet that demonstrates
the problem and would be happy to show it to whoever is lucky
enough to work on this.

Larry

Comments
EVALUATION I have attached a jar file showing this problem. To run, do something like: java -classpath "test.jar" simpleHTML2 The source is also in the jar file. I don't believe this is a swing problem, although swing is triggering it. ImageView (the swing class responsible for loading the image in this case) registers an ImageObserver when creating the Image. With this example, the ImageObserver's imageUpdate is called back with a flag indicating an error loading. In looking through some of the image code (specifically sun.awt.image.InputStreamImageSource) it tries to determine the type of image from the first couple bytes of data. When InputStreamImageSource reads from the InputStream (one of the zip input streams in this case) it gets the bytes 162 71 139 254 instead of 71 73 70 56 (GIF8). Since InputStreamImageSource does not think the file is a valid image it then errors. Further digging into ZipFile would seem to indicate Inflater (or perhaps some of the native code) is getting confused. If ZipFile.getInflater is changed to always return a new Inflater the bytes are correct and the image gets loaded. I'm reassigning to classes_util. scott.violet 1999-03-05 This is a duplicate of 4214785, there seems to be a race condition in the image loading code. ###@###.### 1999-03-11
11-03-1999