On Wed, 11 Mar 2026 21:30:02 GMT, Alexey Ivanov <[email protected]> wrote:

>> Phil Race has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   DataBuffer.java
>
> src/java.desktop/share/classes/java/awt/image/DataBufferByte.java line 185:
> 
>> 183:         super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length);
>> 184:         checkSize(size);
>> 185:         checkNumBanks(dataArray.length);
> 
> Add
> 
> 
> Objects.requireNonNull(dataArray, "dataArray must not be null");
> 
> 
> for consistency with the above constructors… to produce a custom message for 
> `NPE`?

I see, you 
[removed](https://github.com/openjdk/jdk/pull/29766#discussion_r2891396508) 
explicit check for `dataArray == null`.

> src/java.desktop/share/classes/java/awt/image/DataBufferByte.java line 225:
> 
>> 223:         checkSize(size);
>> 224:         checkNumBanks(dataArray.length);
>> 225:         Objects.requireNonNull(offsets, "offsets");
> 
> Suggestion:
> 
>         Objects.requireNonNull(offsets, "offsets must not be null");
> 
> 
> For consistency with the message for `dataArray`.

Remove the explicit check for `offsets == null`, too?

It will be implicitly checked at `dataArray.length != offsets.length` on the 
next line of code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r2921164372
PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r2921171557

Reply via email to