JDK-6793818 : JpegImageReader is too greedy creating color profiles
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-01-14
  • Updated: 2020-11-13
  • Resolved: 2009-05-15
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.
JDK 6 JDK 7
6u14 b01Fixed 7Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Greedy creation of color profiles means that profile data files loaded and CMM library is initialized.

JPEG images without embedded color profiles are read without performing color conversion 
and in these cases CMM library is not needed. We should be avoiding extra work on startup 
(and this also helps to loose dependencies between kernel bundles and in the future JDK7 modules)

Here is sample stacktrace:

java.lang.Exception: CMM!
   at sun.awt.color.CMM.<clinit>(CMM.java:114)
   at java.awt.color.ICC_Profile.activateDeferredProfile(ICC_Profile.java:1072)
   at java.awt.color.ICC_Profile$1.activate(ICC_Profile.java:723)
   at sun.awt.color.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:75)
   at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:756)
   at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:976)
   at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:941)
   at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:892)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.color.ICC_Profile.getStandardProfile(ICC_Profile.java:887)
   at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:858)
   at java.awt.color.ColorSpace.getInstance(ColorSpace.java:315)
   at javax.imageio.ImageTypeSpecifier$Grayscale.<init>(ImageTypeSpecifier.java:587)
   at javax.imageio.ImageTypeSpecifier.createGrayscale(ImageTypeSpecifier.java:668)
   at javax.imageio.ImageTypeSpecifier.createSpecifier(ImageTypeSpecifier.java:1184)
   at javax.imageio.ImageTypeSpecifier.getSpecifier(ImageTypeSpecifier.java:1101)
   at javax.imageio.ImageTypeSpecifier.createFromBufferedImageType(ImageTypeSpecifier.java:884)
   at com.sun.imageio.plugins.jpeg.JPEGImageReader.<clinit>(JPEGImageReader.java:208)
   at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:67)
   at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:296)
   at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:503)
   at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:487)

Comments
EVALUATION We should use deferred loading not only for sRGB, but for all standard profiles in the JRE. In particular case of the jpeg plugin we are interested primarily in GRAY and PYCC profiles, but there is no reason why the deferral loading can not be used for CIEXYZ and linear RGB as well. This change does not introduce any difference in the jre behavior (except deferral profile data loading) if all standard profiles are correctly installed in the jre: any profile-related activity (like a color conversion, profile data accesses and etc.) triggers profile activation.
23-01-2009