[OpenJDK 2D-Dev] RFR: 8204187: Remove proprietary JPEG code from javax.imageio
philip.race at oracle.com
Fri Jun 1 17:05:18 UTC 2018
Bug : https://bugs.openjdk.java.net/browse/JDK-8204187
CSR : https://bugs.openjdk.java.net/browse/JDK-8204189
Webrev : http://cr.openjdk.java.net/~prr/8204187/
Please review the code and the CSR.
There are 4 optional color spaces for the standard JPEG plugin
documented in the
javax.image I/O JPEG metadata specification.
Optional ColorSpace support: Handling of PhotoYCC (YCC), PhotoYCCA
(YCCA), RGBA and YCbCrA
color spaces by the standard plugin, as described below, is dependent on
capabilities of the
libraries used to interpret the JPEG data. Thus all consequential
behaviors are optional.
[and more details]
The necessary support for these is implemented in a modified, closed
source, IJG libjpeg 6b.
What this means is that OpenJDK never has supported these.
However code to handle these on the Java side is implemented in the open
Oracle intends to remove the closed source native support, so we can
clean up the open code.
And there's a particular bug that even the supported YCCK color space
would not work with
OpenJDK due to the ID specified in the Java code not matching the ID
specified in the standard
Another fix is that even though it did not have support for writing
images with alpha,
the writer would say it could - true only for a JDK with the closed
So what would happen is that even if code would check to see if it was
when it tried it would get this exception :
Exception in thread "main" javax.imageio.IIOException: Invalid argument
to native writeImage
With the removal of the Java code related to these color spaces, you
will still get an exception,
but a slightly different one :
Exception in thread "main" javax.imageio.IIOException: Bogus input
The key to avoiding both of these is making sure the code that checks
to see if there is an alpha channel and gives you a correct answer. That
I have also included a new test which covers this and updated an
I am leaving the specification alone for now at least, to leave the door
open to reinstating
such support somehow if it there is a need. If we do it may be just a
I am preparing a release note as well as a CSR for this.
More information about the 2d-dev