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

ClassCastException when doing ColorConvertOp on a Raster (ByteBuffer + SinglePixelPackedSampleModel)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 8u5, 9
    • client-libs
    • 2d
    • generic
    • windows

      import java.awt.color.ColorSpace;
      import java.awt.image.*;

      public class ColorOpTest {
          public static void main(String[] args) {
              new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                      ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null).
                      filter(Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 10,
                              new int[]{0x01, 0x02, 0x04}, null), null);
          }
      }

      causes
      Exception in thread "main" java.lang.ClassCastException: java.awt.image.SinglePixelPackedSampleModel cannot be cast to java.awt.image.ComponentSampleModel
      at sun.java2d.cmm.lcms.LCMSImageLayout.createImageLayout(LCMSImageLayout.java:389)
      at sun.java2d.cmm.lcms.LCMSTransform.colorConvert(LCMSTransform.java:465)
      at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:571)
      at ColorOpTest.main(ColorOpTest.java:17)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:484)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      Reproducible with 8u5, 9.
      Not Reproducible with 7u66, 7u45

            anashaty Anton Nashatyrev (Inactive)
            anashaty Anton Nashatyrev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: