On Tue, 19 May 2026 00:12:01 GMT, Phil Race <[email protected]> wrote:
>> The bug was filed to note that the constructor for >> MultiPixelPackedSampleModel could throw an odd exception if numberOfBits is >> zero. >> Per the spec this should throw RasterFormatException. >> >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Phil Race has updated the pull request incrementally with one additional > commit since the last revision: > > 8381007 src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java line 115: > 113: numberOfBits, > 114: > (int)(((long)w*numberOfBits+DataBuffer.getDataTypeSize(dataType)-1)/ > 115: DataBuffer.getDataTypeSize(dataType)), It appears that it may throw the wrong exception type if it overflows, e.g. : // OK, RasterFormatException new Args4(TYPE_BYTE, 1, 1, 16, RasterFormatException.class), // FAIL: IllegalArgumentException, scanlineStride must be > 0. // The 4-arg constructor doesn't mention this case. // // Based on the current `@throws` clauses, it could be a // RasterFormatException: "MultiPixelPackedSampleModel // does not allow pixels to span data element boundaries", // which is also possible here. new Args4(TYPE_BYTE, 1 << 30, 1, 16, RasterFormatException.class), ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3283261850
