United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6793818 : JpegImageReader is too greedy creating color profiles

Details
Type:
Enhancement
Submit Date:
2009-01-14
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2009-05-15
Component:
client-libs
OS:
generic
Sub-Component:
javax.imageio
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u14 (b01)

Related Reports
Backport:
Relates:

Sub Tasks

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.
                                     
2009-01-23



Hardware and Software, Engineered to Work Together