RFR: 8351108: ImageIO.write(..) fails with exception when writing JPEG with IndexColorModel [v4]
Jeremy Wood
duke at openjdk.org
Mon Mar 10 18:22:50 UTC 2025
On Mon, 10 Mar 2025 17:28:12 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> This is by design.
>>
>> The main method resembles:
>>
>> public static void main(String[] args) throws IOException {
>> boolean b1 = testJpegWriter(Transparency.OPAQUE, "OPAQUE", true);
>> boolean b2 = testJpegWriter(Transparency.BITMASK, "BITMASK", false);
>> boolean b3 = testJpegWriter(Transparency.TRANSLUCENT, "TRANSLUCENT", false);
>> if (!(b1 && b2 && b3))
>> throw new Error("Test failed");
>> }
>>
>>
>> The intention here is to help log multiple failures at once. (Otherwise: if there are two failures A and B, then you can only discover B after resolving A.)
>
> I see. Yet it still implies the `Error` isn't thrown in `result != expectedWriteReturnValue`… because if it is thrown, the test fails right away without running other cases.
>
> It's fine, it's not expected to be thrown, right?
Ah, thanks. I changed that Error to an Exception. (That was probably an old artifact from earlier drafts.)
You're correct: it's not expected to be thrown. (No Throwables should be thrown in this test anymore.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23884#discussion_r1987804948
More information about the client-libs-dev
mailing list