-
Bug
-
Resolution: Fixed
-
P3
-
7, 8, 11, 14, 15, 16
-
b17
As per Java spec
ArrayIndexOutOfBoundsException - if bankIndices or bandOffsets is null.
If we provide bandOffsets as null, existing JDK implementation is throwing NullPointerException which is not as per spec. It should throw ArrayIndexOutOfBoundsException.
A sample demonstrating the problem:
public static void main(String[] args) {
try {
WritableRaster writableRaster = Raster.createBandedRaster(
DataBuffer.TYPE_INT, 5, 1, 3, new int[]{0, 0}, null, new Point());
} catch (Throwable t) {
System.out.println(t);
}
}
Output:
java.lang.NullPointerException: Cannot read the array length because "bandOffsets" is null.
Code snippet causing issue:
int bands = bandOffsets.length;
if (bankIndices == null) {
throw new
ArrayIndexOutOfBoundsException("Bank indices array is null");
}
if (bandOffsets == null) {
throw new
ArrayIndexOutOfBoundsException("Band offsets array is null");
}
ArrayIndexOutOfBoundsException - if bankIndices or bandOffsets is null.
If we provide bandOffsets as null, existing JDK implementation is throwing NullPointerException which is not as per spec. It should throw ArrayIndexOutOfBoundsException.
A sample demonstrating the problem:
public static void main(String[] args) {
try {
WritableRaster writableRaster = Raster.createBandedRaster(
DataBuffer.TYPE_INT, 5, 1, 3, new int[]{0, 0}, null, new Point());
} catch (Throwable t) {
System.out.println(t);
}
}
Output:
java.lang.NullPointerException: Cannot read the array length because "bandOffsets" is null.
Code snippet causing issue:
int bands = bandOffsets.length;
if (bankIndices == null) {
throw new
ArrayIndexOutOfBoundsException("Bank indices array is null");
}
if (bandOffsets == null) {
throw new
ArrayIndexOutOfBoundsException("Band offsets array is null");
}
- csr for
-
JDK-8264625 Raster creation methods need some specification clean up
-
- Closed
-