-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b126
-
generic
-
generic
-
Verified
Specification for constructor
java.awt.image.SampleModel(int dataType, int w, int h, int numBands)
says:
* @throws IllegalArgumentException if the product of <code>w</code>
* and <code>h</code> is greater than
* <code>Integer.MAX_VALUE</code>
This assertion is not satisfied.
If width=1 and height=Integer.MAX_VALUE exception is thrown.
Even if width=1 and height=Integer.MAX_VALUE-10 exception is still thrown.
Please see the following code sample:
-----
import java.awt.image.DataBuffer;
import java.awt.image.SampleModel;
public class Temp {
public static void main(String[] args) {
final int w = Integer.MAX_VALUE - 10;
final int h = 1;
/**
* @throws IllegalArgumentException if the product of <code>w</code>
* and <code>h</code> is greater than
* <code>Integer.MAX_VALUE</code>
*/
new SampleModel(DataBuffer.TYPE_BYTE, w, h, 1) {
public int getNumDataElements() {
return 0;
}
public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
return null;
}
public void setDataElements(int x, int y, Object obj, DataBuffer data) {
}
public int getSample(int x, int y, int b, DataBuffer data) {
return 0;
}
public void setSample(int x, int y, int b, int s, DataBuffer data) {
}
public SampleModel createCompatibleSampleModel(int w, int h) {
return null;
}
public SampleModel createSubsetSampleModel(int bands[]) {
return null;
}
public DataBuffer createDataBuffer() {
return null;
}
public int[] getSampleSize() {
return new int[0];
}
public int getSampleSize(int band) {
return 0;
}
};
}
}
java.awt.image.SampleModel(int dataType, int w, int h, int numBands)
says:
* @throws IllegalArgumentException if the product of <code>w</code>
* and <code>h</code> is greater than
* <code>Integer.MAX_VALUE</code>
This assertion is not satisfied.
If width=1 and height=Integer.MAX_VALUE exception is thrown.
Even if width=1 and height=Integer.MAX_VALUE-10 exception is still thrown.
Please see the following code sample:
-----
import java.awt.image.DataBuffer;
import java.awt.image.SampleModel;
public class Temp {
public static void main(String[] args) {
final int w = Integer.MAX_VALUE - 10;
final int h = 1;
/**
* @throws IllegalArgumentException if the product of <code>w</code>
* and <code>h</code> is greater than
* <code>Integer.MAX_VALUE</code>
*/
new SampleModel(DataBuffer.TYPE_BYTE, w, h, 1) {
public int getNumDataElements() {
return 0;
}
public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
return null;
}
public void setDataElements(int x, int y, Object obj, DataBuffer data) {
}
public int getSample(int x, int y, int b, DataBuffer data) {
return 0;
}
public void setSample(int x, int y, int b, int s, DataBuffer data) {
}
public SampleModel createCompatibleSampleModel(int w, int h) {
return null;
}
public SampleModel createSubsetSampleModel(int bands[]) {
return null;
}
public DataBuffer createDataBuffer() {
return null;
}
public int[] getSampleSize() {
return new int[0];
}
public int getSampleSize(int band) {
return 0;
}
};
}
}
- relates to
-
JDK-6735275 java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
-
- Closed
-