On Thu, 24 Sep 2026 02:57:45 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> This fixes a corner case (although the corner repeats in a number of 
>> locations), whereby a specified NPE for null parameters doesn't happen 
>> because code that would throw is not reached when width or height is zero.
>> No existing tests fail, and the new jtreg test passes whereas it fails 
>> without this fix.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.desktop/share/classes/java/awt/image/SampleModel.java line 607:
> 
>> 605: 
>> 606:         if (obj == null) {
>> 607:             throw new NullPointerException("Array must not be null");
> 
> Shouldn't it be "object must not be null", there's no array here

Array is correct. Read the javadoc which says " obj must be a primitive array 
of type TransferType. "

> test/jdk/java/awt/image/SampleModelNullTests.java line 57:
> 
>> 55:             operation.run();
>> 56:             if (npe) {
>> 57:                 throw new RuntimeException("No NPE for " + description);
> 
> probably test can be improved to not bail out on 1st failure since so many 
> test checks are being done...maybe we can collate the failures and fail 
> later..

The same could be said for lots of jtreg tests, and I don't see the point.
If one case fails, the fixer will find out pretty quickly if more cases fail.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33042#discussion_r4096436216
PR Review Comment: https://git.openjdk.org/jdk/pull/33042#discussion_r4096460704

Reply via email to