JDK-5034864 : remove spurious printStackTrace() calls in ImageIO classes
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0,8,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2004-04-20
  • Updated: 2018-09-05
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
tbdUnresolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
There are unnecessary e.printStackTrace() calls in two IIO classes:
    com.sun.imageio.spi.FileImageOutputStreamSpi
    com.sun.imageio.spi.RAFImageOutputStreamSpi

The printStackTrace() calls occur when a generic exception is caught in
createOutputStreamInstance().  The generated console output is annoying
because it cannot be supressed.

It is also worth considering whether these methods should even be catching
(and eating) generic exceptions.  The spec does not say that null is an
acceptable return value from those methods.

---------------------------

There are also 2 calls to e.printStackTrace() in com.sun.imageio.plugins.png.PNGImageReader.java in IOException clauses.  These should be removed as well.

Also, a general run through the rest of ImageIO should be made to ensure that we don't have other stackTrace() calls lying in wait for future bug submissions; I can't see that we need or want any stack trace calls in code that users may trip over.

###@###.### 2004-09-07

Comments
Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
18-03-2014

EVALUATION See also 6247985. As mentioned in the description field of this bug report, null is not a valid return value from ImageOutputStreamSpi.createOutputStreamInstance(). I suggest that File/RAFImageOutputStreamSpi.cOSI() wrap a non-IOException with a IOException instead of returning null. We should also remove the unnecessary printStackTrace() call as described earlier. Similar changes should probably be made to the ImageInputStreamSpi implementations as well. The ImageOutputStreamSpi.createOutputStreamInstance() spec says only that an IOException will be thrown "if a cache file is needed but cannot be created". We should probably expand that to say "or if an error occurs while creating the output stream". This will likely require a CCC request. With these changes in place, the issue reported in 6247985 should be resolved.
25-10-2005

EVALUATION Easy fix, but will have to consider the spec-related issues. ###@###.### 2004-04-20
20-04-2004