Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328927

java.awt.color.CMMException: LCMS error 13: Mismatched alpha channels

XMLWordPrintable

    • x86_64
    • os_x
    • Verified

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS X 14.3.1 (23D60)

      A DESCRIPTION OF THE PROBLEM :
      CMMException is being thrown even though it should not. Source code below for an explanation.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the source code to get a demonstration of the problem.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should run just fine without raising any exceptions and print ok
      ACTUAL -
      It throws an error:

      Exception in thread "main" java.awt.color.CMMException: LCMS error 13: Mismatched alpha channels
          at java.desktop/sun.java2d.cmm.lcms.LCMS.createNativeTransform(Native Method)
          at java.desktop/sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:113)
          at java.desktop/sun.java2d.cmm.lcms.LCMSTransform.doTransform(LCMSTransform.java:114)
          at java.desktop/sun.java2d.cmm.lcms.LCMSTransform.colorConvert(LCMSTransform.java:149)
          at java.desktop/java.awt.image.ColorConvertOp.ICCBIFilter(ColorConvertOp.java:350)
          at java.desktop/java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:277)
          at com.vanniktech.playground.kotlin.MainKt.main(Main.kt:55)
          at com.vanniktech.playground.kotlin.MainKt.main(Main.kt)

      ---------- BEGIN SOURCE ----------
      public class PDFBOX5787
      {
          public static void main(String[] args) throws IOException
          {
              ColorConvertOp colorConvertOp = new ColorConvertOp(null);
              URL url = new URL("https://issues.apache.org/jira/secure/attachment/13067493/CGATS001Compat-v2-micro.icc");
              ICC_Profile iccProfile = ICC_Profile.getInstance(url.openStream());
              ICC_ColorSpace icc_ColorSpace = new ICC_ColorSpace(iccProfile);

              WritableRaster raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, 1, 1,
                      4, new Point(0, 0));

              ColorModel colorModel = new ComponentColorModel(icc_ColorSpace,
                      false, false, Transparency.OPAQUE, raster.getDataBuffer().getDataType());

              BufferedImage src = new BufferedImage(colorModel, raster, false, null);
              BufferedImage dest = new BufferedImage(raster.getWidth(), raster.getHeight(),
                      BufferedImage.TYPE_INT_RGB);
              colorConvertOp.filter(src, dest);
              System.out.println("ok");
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Switching to zulu distribution.

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: