JDK-4892246 : Image I/O breaks when used with Java Web Start
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.2_02,5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-07-17
  • Updated: 2003-07-17
  • Resolved: 2003-07-17
Related Reports
Duplicate :  
Description
The Image I/O PNG reader (and possibly other readers; have not tested) breaks
when used in conjunction with Java Web Start.

The attached test case illustrates the problem.
ClassLoader.getResourceAsStream() is used to fetch an InputStream for a PNG
image contained within the jar. When that InputStream is fed directly into
ImageIO.read(), the reader throws an exception. If a BufferedInputStream is
used to wrap that InputStream, the read succeeds. The read also succeeds if
all of the data in the stream is read manually into a byte array first and a
ByteArrayInputStream is fed into ImageIO.read(). Clearly Image I/O is assuming
something about the buffering behavior of incoming InputStreams, and possibly
something about the semantics of mark/read that might not hold true for
unbuffered input streams.

See comments section for location of test cases.

This bug is being reported against 1.4.2_02 as well as 1.5 because the bug looks
critical and the fix should be backported.

Comments
WORK AROUND Wrap InputStreams in BufferedInputStreams, or read all data into a byte array and pass in a ByteArrayInputStream to ImageIO.read().
11-06-2004

EVALUATION Sounds similar to 4764639, which was already fixed in Tiger. I'm not able to reproduce the failure using Java WebStart in the latest Tiger build on Solaris. I've contacted the submitter for more info, such as reproducible platform and build. ###@###.### 2003-07-17 Received confirmation from submitter that this was actually fixed in 1.5; closing as a duplicate of 4764639. ###@###.### 2003-07-17
17-07-2003