RFR: 8351110: ImageIO.write for JPEG can write corrupt JPEG for certain thumbnail dimensions [v4]

Jeremy Wood duke at openjdk.org
Sat Apr 5 05:11:50 UTC 2025


On Fri, 4 Apr 2025 18:58:22 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Jeremy Wood has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - 8351110: adding a few clarifying comments
>>  - 8351110: changing `catch` statement to support assertEquals's Error
>
> test/jdk/javax/imageio/plugins/jpeg/WriteJPEGThumbnailTest.java line 86:
> 
>> 84:                 } finally {
>> 85:                     jpegData = byteOut.toByteArray();
>> 86:                 }
> 
> Does it have to be in the `finally` block?
> 
> You can assign `jpegData` outside of the `try` block. If an exception is thrown in `try`, the method stops executing and assigning to `jpegData` makes no sense.

No; this is updated

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23920#discussion_r2029703152


More information about the client-libs-dev mailing list