-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P3
-
Affects Version/s: 17, 21, 25, 26, 27
-
Component/s: client-libs
-
None
from spec of
createBandedRaster(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point location),
we have:
IllegalArgumentException – if scanlineStride is less than 0.
However, when I tried large negative values such as -1000 or Integer.MIN_VALUE, I encountered a java.lang.NegativeArraySizeException instead of the expected IllegalArgumentException.
After reviewing the code, I noticed that the exception is thrown before execution reaches the check for scanlineStride < 0. Specifically, it occurs in the following block:
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte(size, banks);
break;
As a result, the documented exception behavior is not consistently enforced for all negative values of scanlineStride.
I think this warrants a documentation enhancement to clarify the actual behavior.
createBandedRaster(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point location),
we have:
IllegalArgumentException – if scanlineStride is less than 0.
However, when I tried large negative values such as -1000 or Integer.MIN_VALUE, I encountered a java.lang.NegativeArraySizeException instead of the expected IllegalArgumentException.
After reviewing the code, I noticed that the exception is thrown before execution reaches the check for scanlineStride < 0. Specifically, it occurs in the following block:
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte(size, banks);
break;
As a result, the documented exception behavior is not consistently enforced for all negative values of scanlineStride.
I think this warrants a documentation enhancement to clarify the actual behavior.
- links to
-
Review(master)
openjdk/jdk/29454