RFR: 6185110: Undefined behaviour of SampleModel for width, height < 0 [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Tue Nov 25 03:38:15 UTC 2025
On Fri, 21 Nov 2025 23:05:41 GMT, Phil Race <prr at openjdk.org> wrote:
>> src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java line 603:
>>
>>> 601: * @param data The DataBuffer containing the image data
>>> 602: * @see #getDataElements(int, int, Object, DataBuffer)
>>> 603: * @throws NullPointerException if {@code data} is null.
>>
>> I guess we will get NPE if (@code obj] is also null...Shouldn't we specify that too?
>
> I updated this as you can see.
Can we specify the NPEs in the same line like what it is done in l675 to be consistent and also to be concise?
`@throws NullPointerException if {@code obj} or {code data} is null.`
>> src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line 901:
>>
>>> 899: * @param data the DataBuffer containing the image data
>>> 900: * @see #getDataElements(int, int, Object, DataBuffer)
>>> 901: * @throws NullPointerException if {@code data} is null.
>>
>> same here
>
> I updated this as you can see.
same, can we put it in single line as done in l974?
>> src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java line 597:
>>
>>> 595: * @param data the {@code DataBuffer} containing the image data
>>> 596: * @see #getDataElements(int, int, Object, DataBuffer)
>>> 597: * @throws NullPointerException if {@code data} is null.
>>
>> here too
>
> I updated this as you can see.
here too same line?
>> src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java line 571:
>>
>>> 569: * @param data The DataBuffer containing the image data.
>>> 570: * @see #getDataElements(int, int, Object, DataBuffer)
>>> 571: * @throws NullPointerException if {@code data} is null.
>>
>> same...NPE for null obj?
>
> I updated this as you can see.
same can be done in single line?!!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2558420555
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2558422207
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2558424470
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2558425032
More information about the client-libs-dev
mailing list