-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
None
-
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
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
- duplicates
-
JDK-6993561 java.awt.image.SampleModel.setSamples() methods not always throw ArrayIndexOutOfBoundsException
-
- Closed
-