RFR: 8364135: JPEGImageReader.getImageTypes() should throw exception for non-zero image index

Alisen Chung achung at openjdk.org
Fri Aug 1 00:34:54 UTC 2025


On Tue, 29 Jul 2025 05:38:00 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> We need to throw appropriate exception when we pass invalid image index values to ImageReader.getImageTypes().
> We throw IOOBE in all other plugins except JPEG, Added appropriate check to throw IOOBE when JpegImageReader has invalid image index.

test/jdk/javax/imageio/plugins/jpeg/JpegNegativeImageIndexTest.java line 53:

> 51:         ImageReader ir = readers.next();
> 52:         try {
> 53:             Iterator<ImageTypeSpecifier> types = ir.getImageTypes(-1);

You could expand the test to call this with different non-zero parameters (-2, -1, 1, 2) to see if the behavior is correct

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2246625248


More information about the client-libs-dev mailing list