Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorSpacesTest#testCorbisRGBSpecialHandling() fails with JDK8/LCMS #41

Closed
ankon opened this issue Mar 3, 2014 · 8 comments
Closed
Milestone

Comments

@ankon
Copy link
Contributor

ankon commented Mar 3, 2014

When building with JDK 8 (b129) the ColorSpacesTest#testCorbisRGBSpecialHandling() fails:

-------------------------------------------------------------------------------
Test set: com.twelvemonkeys.imageio.color.ColorSpacesTest
-------------------------------------------------------------------------------
Tests run: 18, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.067 sec <<< FAILURE!
testCorbisRGBSpecialHandling(com.twelvemonkeys.imageio.color.ColorSpacesTest)  Time elapsed: 0.007 sec  <<< FAILURE!
java.lang.AssertionError: array lengths differed, expected.length=452 actual.length=420
    at org.junit.Assert.fail(Assert.java:91)
    at org.junit.internal.ComparisonCriteria.assertArraysAreSameLength(ComparisonCriteria.java:72)
    at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:36)
    at org.junit.Assert.internalArrayEquals(Assert.java:414)
    at org.junit.Assert.assertArrayEquals(Assert.java:200)
    at org.junit.Assert.assertArrayEquals(Assert.java:213)
    at com.twelvemonkeys.imageio.color.ColorSpacesTest.testCorbisRGBSpecialHandling(Unknown Source)

This seems to be caused by the use of LCMS in JDK8, while earlier JDKs use kcms. The test can be made to pass by using the JVM arguments to switch back to kcms:

-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider

Unofrtunately I cannot get my JDK 1.7.0u45 to use LCMS to check in the other direction.

@haraldk
Copy link
Owner

haraldk commented Mar 3, 2014

Hi Andreas,

Thanks for reporting (and good analysis too)!

This is a known issue (kind of)... The same issue is present if you use an OpenJDK build, rather than an Oracle build of Java 6 or 7, which also uses LCMS rather than KCMS. I think there are a few more tests that fails too, using LCMS (if these pass using JDK 8, cool!).

I haven't filed a bug for it, as I haven't seen the need to support OpenJDK. But if LCMS is the default for JDK 8, it seems we have to take action...

I wasn't aware that you could change color management system using command line, is this a new JDK 8 feature?

For short term, building with KCMS seems like the only option, but then you probably should use that flag at run-time too.

Harald K

@ankon
Copy link
Contributor Author

ankon commented Mar 3, 2014

From what I can see JDK8 (Open~ and Oracle ~) both use LCMS by default now (https://bugs.openjdk.java.net/browse/JDK-8011622).

As to switching: it seems that switching should have been possible before, by using -Dsun.java2d.cmm=sun.java2d.cmm.lcms.LCMS, but this didn't work in my brief testing with JDK 7u45. This is purely based on reading the commit for the bug itself, I haven't found official "documentation" about this feature.

@ankon
Copy link
Contributor Author

ankon commented Mar 3, 2014

if these pass using JDK 8, cool!

Running with

JAVA_HOME=/usr/jdk8 mvn clean install -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider

shows three failures:

Failed tests:   testReadSubsamplingBounds1027(com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderTest): expected:<16711421> but was:<16711677>
  testReadSubsamplingBounds1026(com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderTest): expected:<16711421> but was:<16711677>
  testReadSubsamplingBounds1024(com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderTest): expected:<16711421> but was:<16711677>

These however I also get with JDK 7u45, so they don't seem to be JDK8-specific.

@haraldk
Copy link
Owner

haraldk commented Mar 3, 2014

Hmmm..

If you have some time to look into this, one think you could test is if the special handling of the broken profile really is needed with LCMS? While the Java implementation in some cases is incompatible with the KCMS one, LCMS seems more lenient about issues like the one that is tested for in the failing test. We might not need it at all.

If the special handling isn't needed, all we need is a way to detect CMS at runtime and skip the hotfix in case of LCMS.

...plus some serious CI-setup on Travis, to make sure we build and test on multiple JDKs/CMSs... :-P

Harald K

@haraldk
Copy link
Owner

haraldk commented Mar 3, 2014

Re: testReadSubsamplingBounds...

Oh great... I added those tests yesterday (see #39 and #40), and they passed on my setup... I'll have to add some fuzzyness to the assertions I guess...

Please file new issues for these findings if they fail on normal Oracle 7 JDK.

Harald K

@ankon
Copy link
Contributor Author

ankon commented Mar 3, 2014

Will have a look into whether the work-around is needed later today or tomorrow. At the moment JDK8 isn't released, I just noticed the issue in some local test builds (my default JDK is usually a fresh JDK 8 snapshot build to detect such issues before our customers do :D)

@haraldk haraldk added this to the 3.1 milestone Mar 19, 2014
@haraldk
Copy link
Owner

haraldk commented Jan 6, 2015

Fixed in f588d65.

Harald K

@haraldk haraldk closed this as completed Jan 6, 2015
@haraldk
Copy link
Owner

haraldk commented Jan 7, 2015

And better yet, in 94ed531. :-)

Harald K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants