On Wed, 7 Oct 2026 21:27:39 GMT, Phil Race <[email protected]> wrote:

>> Specifying the behaviour of BufferedImage constructors for invalid 
>> dimensions is long overdue.
>> 
>> The behaviour for image types and sizes <= 0 is unchanged by this PR.
>> Also in many cases the behaviour for sizes that are too large is also 
>> unchanged.
>> In some cases, the behaviour is changed from "accidental" 
>> NegativeArraySizeException to a consistent IllegalArgumentException.
>> 
>> In no case is anything changed that would affect the possibility to 
>> construct a BufferedImage.
>> 
>> A test is provided to ensure the behaviour.
>> 
>> A CSR is provided too : https://bugs.openjdk.org/browse/JDK-8369155
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   4617681

Similar update needs to be done in CSR also.

src/java.desktop/share/classes/java/awt/image/BufferedImage.java line 336:

> 334:      * @implNote
> 335:      * This implementation uses a single data bank to store all image 
> data for
> 336:      * the pre-defined image types {@code TYPE_3BYTE_BGR}, {@code 
> TYPE_4BYTE_BGR},

TYPE_4BYTE_BGR ? Also we need to mention TYPE_4BYTE_ABGR_PRE.

src/java.desktop/share/classes/java/awt/image/BufferedImage.java line 691:

> 689:      *          {@code raster} is incompatible with {@code cm}
> 690:      * @throws IllegalArgumentException if
> 691:      *          {@code raster.minX} or {@code m.minXinY} is not zero

It should be raster.minY

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

PR Review: https://git.openjdk.org/jdk/pull/27640#pullrequestreview-5858506661
PR Review Comment: https://git.openjdk.org/jdk/pull/27640#discussion_r4537707843
PR Review Comment: https://git.openjdk.org/jdk/pull/27640#discussion_r4537742479

Reply via email to