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

AffineTransformOp.filter(BufferedImage, BufferedImage) fails with InternalError

XMLWordPrintable

    • 2d
    • b126
    • x86
    • windows_xp
    • Verified

      FULL PRODUCT VERSION :
      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP3 i386
      Fedora Linux 9 i386
      Fedora Linux 10 i386


      A DESCRIPTION OF THE PROBLEM :
      Under certain conditions, java.awt.image.AffineTransformOp fails with
      Exception in thread "main" java.lang.InternalError: Can't grab SPPSM fields
      at sun.awt.image.ImagingLib.transformBI(Native Method)
      at sun.awt.image.ImagingLib.filter(ImagingLib.java:238)
      at java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:266)

      This behavior is not visible in any previous version of Java. The exact same code succeeds with 1.4.2 and 5.0

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I wrote a sample program that reproduces the error:

      import java.awt.geom.AffineTransform;
      import java.awt.image.AffineTransformOp;
      import java.awt.image.BufferedImage;
      import java.awt.image.ColorModel;
      import java.awt.image.DataBuffer;
      import java.awt.image.DataBufferByte;
      import java.awt.image.IndexColorModel;
      import java.awt.image.Raster;
      import java.awt.image.SampleModel;
      import java.awt.image.SinglePixelPackedSampleModel;
      import java.awt.image.WritableRaster;

      public class Test {

      public static void main(String[] args) {

      byte[] screenBufferBytes = new byte [1024 * 728];
      ColorModel colourModel8 = new IndexColorModel(8, 255, new byte[255], new byte[255], new byte[255]);
      DataBuffer dbuf = new DataBufferByte(screenBufferBytes, screenBufferBytes.length);
      SampleModel samplemodel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 1024, 728, new int[] {0xffff});
      WritableRaster raster = Raster.createWritableRaster(samplemodel, dbuf, null);
      BufferedImage screenImage = new BufferedImage(colourModel8, raster, false, null);
      AffineTransform tx = new AffineTransform();
      tx.scale(0.5, 0.5);
      AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
      BufferedImage image = op.filter(screenImage, null); // Fails here
      System.out.println(image.getClass().getName());

      }

      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      op.filter(screenImage, null) should return not throw an internal error.
      ACTUAL -
      Exception in thread "main" java.lang.InternalError: Can't grab SPPSM fields
      at sun.awt.image.ImagingLib.transformBI(Native Method)
      at sun.awt.image.ImagingLib.filter(ImagingLib.java:238)
      at java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:266)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.InternalError: Can't grab SPPSM fields
      at sun.awt.image.ImagingLib.transformBI(Native Method)
      at sun.awt.image.ImagingLib.filter(ImagingLib.java:238)
      at java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:266)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.awt.geom.AffineTransform;
      import java.awt.image.AffineTransformOp;
      import java.awt.image.BufferedImage;
      import java.awt.image.ColorModel;
      import java.awt.image.DataBuffer;
      import java.awt.image.DataBufferByte;
      import java.awt.image.IndexColorModel;
      import java.awt.image.Raster;
      import java.awt.image.SampleModel;
      import java.awt.image.SinglePixelPackedSampleModel;
      import java.awt.image.WritableRaster;

      public class Test {

      public static void main(String[] args) {

      byte[] screenBufferBytes = new byte [1024 * 728];
      ColorModel colourModel8 = new IndexColorModel(8, 255, new byte[255], new byte[255], new byte[255]);
      DataBuffer dbuf = new DataBufferByte(screenBufferBytes, screenBufferBytes.length);
      SampleModel samplemodel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 1024, 728, new int[] {0xffff});
      WritableRaster raster = Raster.createWritableRaster(samplemodel, dbuf, null);
      BufferedImage screenImage = new BufferedImage(colourModel8, raster, false, null);
      AffineTransform tx = new AffineTransform();
      tx.scale(0.5, 0.5);
      AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
      BufferedImage image = op.filter(screenImage, null); // Fails here
      System.out.println(image.getClass().getName());

      }

      }
      ---------- END SOURCE ----------

      Release Regression From : 5.0u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            bae Andrew Brygin
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: