RFR: 8351108: ImageIO.write(..) fails with exception when writing JPEG with IndexColorModel [v5]

Alexey Ivanov aivanov at openjdk.org
Tue Mar 11 14:46:00 UTC 2025


On Mon, 10 Mar 2025 20:38:45 GMT, Jeremy Wood <duke at openjdk.org> wrote:

>> Previously ImageTypeSpecifier treated all TYPE_BYTE_INDEXED as if they were opaque.
>> 
>> In this ticket's case: an ImageWriter received the wrong ImageTypeSpecifier and mistakenly indicated it *could* support a BufferedImage. But when the actual BufferedImage arrived (which was translucent), the ImageWriter threw an exception.
>> 
>> Instead:
>> Now the ImageTypeSpecifier accurately describes the given BufferedImage.
>
> Jeremy Wood has updated the pull request incrementally with six additional commits since the last revision:
> 
>  - Merge branch 'JDK-8351108' of https://github.com/mickleness/jdk into JDK-8351108
>  - Update test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java
>    
>    Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
>  - Update test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java
>    
>    Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
>  - 8351108: removing method javadoc
>    
>    This is in response to:
>    https://github.com/openjdk/jdk/pull/23884#discussion_r1987896914
>  - Update test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java
>    
>    Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
>  - Update test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java
>    
>    Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>

test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java line 37:

> 35: import java.awt.image.IndexColorModel;
> 36: import java.io.ByteArrayOutputStream;
> 37: import java.io.IOException;

I'd appreciate if you remove `IOException` from imports, it's unused now.
Suggestion:

import java.io.ByteArrayOutputStream;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23884#discussion_r1989454070


More information about the client-libs-dev mailing list