RFR: 8364135: JPEGImageReader.getImageTypes() should throw exception for negative image index [v2]
Jayathirth D V
jdv at openjdk.org
Mon Aug 25 09:47:55 UTC 2025
On Thu, 21 Aug 2025 20:46:41 GMT, Phil Race <prr at openjdk.org> wrote:
>> Jayathirth D V has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>>
>> - Update test to handle all regression cases
>> - Add checks at other places also
>> - Merge remote-tracking branch 'upstream/master' into jpeg_getImageTypes
>> - Check only for negative index
>> - 8364135: JPEGImageReader.getImageTypes() should throw exception for non-zero image index
>
> test/jdk/javax/imageio/plugins/jpeg/JpegNegativeImageIndexTest.java line 60:
>
>> 58: ImageTypeSpecifier specifier = ir.getRawImageType(-1);
>> 59: } catch (IndexOutOfBoundsException e) {
>> 60: if (Objects.equals(e.getMessage(), "imageIndex < 0")) {
>
> A bit fragile checking the exception text, but I suppose it won't be changed unless this test changes too.
Yes since we are just initializing the ImageReader and querying for -1 index(where minIndex will always be 0), there will be no issues.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2297638502
More information about the client-libs-dev
mailing list