RFR: 8364135: JPEGImageReader.getImageTypes() should throw exception for negative image index [v5]
Alexey Ivanov
aivanov at openjdk.org
Thu Aug 28 13:08:46 UTC 2025
On Tue, 26 Aug 2025 06:03:01 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.
>
> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
>
> Keep verifyImageIndex in try block
Looks good to me, however, the test could be improved somewhat.
test/jdk/javax/imageio/plugins/jpeg/JpegNegativeImageIndexTest.java line 52:
> 50:
> 51: private static void testMethod(String methodName,
> 52: RunnableWithException method) {
The `testMethod` could return `true` to indicate success (the expected exception is caught), and `false` otherwise.
Then you combine the result of the method calls.
test/jdk/javax/imageio/plugins/jpeg/JpegNegativeImageIndexTest.java line 67:
> 65: private interface RunnableWithException {
> 66: void run() throws Exception;
> 67: }
You can use `Callable<?>` instead.
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26522#pullrequestreview-3164724835
PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2307321698
PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2307317327
More information about the client-libs-dev
mailing list