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

Alexey Ivanov aivanov at openjdk.org
Wed Apr 9 14:59:52 UTC 2025


On Sat, 5 Apr 2025 05:09:18 GMT, Jeremy Wood <duke at openjdk.org> wrote:

>> 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

It is still in the `finally` block. Did you miss a commit?

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

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


More information about the client-libs-dev mailing list