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

There is no expected Exception in SampleModel getPixels(int, int, int, int, float[], DataBuffer)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • None
    • 2d
    • x86
    • generic

      There is no expected ArrayOfBoundsException in methods
      getPixels, setPixels, getSamples, setSamples, getDataElements, setDataElements when x or y equals Integer.MAX_VALUE
      and type of given array is float or double.

      All works fine, when in getPixels, setPixels, getSamples, setSamples parameters include int[] not float[] or double[].

      See next example, there is output there, but message about exceptions is expected.
      ----------------------------------------------------------------------------------------------------------
      import java.awt.image.*;
      import java.awt.*;

      public class Test {
          static SampleModel[] models = new SampleModel[4] ;
          static int defaultWidth = 6;
          static int defaultHeight = 4;
          public static void test1() {
              SampleModel model = Raster.createBandedRaster(DataBuffer.TYPE_INT, defaultWidth, defaultHeight, 4, null).getSampleModel();
              DataBuffer data = model.createDataBuffer();
      // if change float[] to int[] in next line all will fine.
              float[] iArray = new float[defaultWidth * defaultHeight * model.getNumBands()];
              model.setPixels(Integer.MAX_VALUE, 0, 1, 1, iArray, data);
          }
          public static void main(String[] a) {
              test1();
          }

      }
      ###@###.### 10/27/04 13:00 GMT

            Unassigned Unassigned
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: