On Tue, 16 Jun 2026 22:06:20 GMT, Phil Race <[email protected]> wrote:

>> In JDK 26 the spec for various methods in Raster were updated under 
>> https://bugs.openjdk.org/browse/JDK-8369129
>> 
>> It was discovered that some cases did not actually check an out-of-bounds 
>> bank index as specified
>> There was a test for two of these cases but there was a bug which caused it 
>> to get the expected exception for a different reason.
>> 
>> The implementation and the test are fixed.
>> 
>> 
>> 
>> ---------
>> - [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:
> 
>   8386671

src/java.desktop/share/classes/java/awt/image/Raster.java line 814:

> 812:         }
> 813:         if (pixelStride <= 0) {
> 814:             throw new IllegalArgumentException("pixelStride is <= 0");

I am replying in-line to Alexander's comment : 
"Note that the <= 0 check contradicts the doc stating less than 0"

Yes, this needs to be changed to < 0

Disallowing zero for the other createInterleavedRaster method was introduced 
here 

https://github.com/openjdk/jdk/pull/27627#discussion_r2446128878

But it was done cautiously and the factory method you highlight could create
a Raster even if stride was zero. The one that disallows it always had an 
exception for a zero stride.

I won't revisit that today, even though this is all odd.
 I'll just update the fix to re-allow zero on this 2nd factory method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31540#discussion_r3463732167

Reply via email to