TwelveMonkeys: Could not initialize class com.twelvemonkeys.imageio.color.ColorSpaces

Ever since upgrading to 3.4, I keep getting sporadic exceptions during the initialization of our software. This is the stacktrace:

Could not initialize class com.twelvemonkeys.imageio.color.ColorSpaces
java.lang.ExceptionInInitializerError
        at com.twelvemonkeys.imageio.color.YCbCrConverter.buildYCCtoRGBtable(YCbCrConverter.java:57)
        at com.twelvemonkeys.imageio.color.YCbCrConverter.<clinit>(YCbCrConverter.java:77)
        at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.convertYCbCr2RGB(JPEGImageReader.java:1276)
        at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.readImageAsRasterAndReplaceColorProfile(JPEGImageReader.java:502)
        at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:388)
        at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
        ...
Caused by: java.lang.NullPointerException
        at java.desktop/sun.java2d.cmm.lcms.LCMS.getProfileSize(LCMS.java:67)
        at java.desktop/java.awt.color.ICC_Profile.getData(ICC_Profile.java:1332)
        at com.twelvemonkeys.imageio.color.ColorSpaces.<clinit>(ColorSpaces.java:105)
        ... 18 more

This doesn’t happen every time, it’s pretty sporadic. Any ideas? I’m on Linux if that matters. Please tell me if you need any more information.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I suggest trying JDK17 where this problem should be fixed and report any new issues you may found.

@boris-petrov Different language, I guess. In Java, you would write .getData();.

.k

@boris-petrov

Ah, my bad, I ignorantly posted Kotlin code. haraldk is correct.

For more on the issue see: https://github.com/haraldk/TwelveMonkeys/issues/402

Thanks,

Yes, I think you should. It may be a duplicate, but at least it’s good for the JDK team to see that people still run into problems with the LCMS implementation.

There hasn’t been reported any bugs for the 3.4 version so far, so I guess not. But it’s likely that more people will in the near future.

I’ll make a fix soon.

– Harald K