On Thu, 4 Dec 2025 19:57:17 GMT, Alexey Ivanov <[email protected]> wrote:

>> Phil Race has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   4617681
>
> src/java.desktop/share/classes/java/awt/image/BufferedImage.java line 602:
> 
>> 600:              throw new IllegalArgumentException(
>> 601:                       "width " + width + " height " + height + " 
>> overflow int");
>> 602:          }
> 
> Does it make sense to move these checks into a separate method to avoid 
> duplicating code at lines 338–346?
> 
> https://github.com/openjdk/jdk/blob/7fb58b903bb747000d40318030db27187de75e98/src/java.desktop/share/classes/java/awt/image/BufferedImage.java#L338-L346
> 
> `spp` can be passed as a parameter to the helper method in the above case, or 
> the value of 1 in this case.
> 
> Using one method to validate the parameters will ensure the messages are 
> consistent. Currently, the asterisk `*` is _still_ missing at line 601 
> whereas it's _now_ present at line 345.

I moved these to a separate method

> src/java.desktop/share/classes/java/awt/image/BufferedImage.java line 674:
> 
>> 672:      *          {@code raster} is incompatible with {@code cm}
>> 673:      * @throws IllegalArgumentException if
>> 674:      *          {@code raster}, {@code minX} or {@code minY} is not zero
> 
> Suggestion:
> 
>      * @throws IllegalArgumentException if
>      *          {@code raster.minX} or {@code raster.minY} is not zero
> 
> 
> The code verifies the values of `minX` and `minY` of the `raster`.
> 
> I didn't figure out the correct way in [my previous 
> comment](https://github.com/openjdk/jdk/pull/27640#discussion_r2565722017).

done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27640#discussion_r4211933469
PR Review Comment: https://git.openjdk.org/jdk/pull/27640#discussion_r4211925429

Reply via email to