On Tue, 5 May 2026 21:26:08 GMT, Phil Race <[email protected]> wrote:
>> This is mostly spec updates.
>> A PixelInterleavedSampleModel constructor did not specify what happens with
>> some illegal arguments
>>
>> It was also reported that the same problem exists for the
>> createSubsetSampleModel so that is updated too, but I then went and looked
>> at this method in other SampleModel subclasses and updated those too.
>>
>> The super-class SampleModel. createSubsetSampleModel is NOT updated because
>> in fact one subclass behaves differently because it supports only one band.
>> That subclass is handled in a related PR, not this one.
>>
>> ---------
>> - [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:
>
> 8378464
src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java line 176:
> 174: * @throws ArrayIndexOutOfBoundsException if any of the bank indices
> is out of bounds
> 175: */
> 176: public SampleModel createSubsetSampleModel(int[] bands) {
Do we need to update the spec for the parent SampleModel class?
src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line
402:
> 400: * @throws RasterFormatException if the number of bands is greater
> than
> 401: * the number of banks in this sample
> model.
> 402: * @throws ArrayIndexOutOfBoundsException if any of the bank indices
> is out of bounds
bank --> band
src/java.desktop/share/classes/java/awt/image/PixelInterleavedSampleModel.java
line 2:
> 1: /*
> 2: * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights
> reserved.
Copyright year should be bumped?
src/java.desktop/share/classes/java/awt/image/PixelInterleavedSampleModel.java
line 162:
> 160: * @throws RasterFormatException if the number of bands is greater
> than
> 161: * the number of bands in this sample
> model.
> 162: * @throws ArrayIndexOutOfBoundsException if any of the bank indices
> is out of bounds
>if any of the bank indices is out of bounds
should be
>if any of the band indices is out of bounds
?
src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java
line 310:
> 308: * an image with a subset of the bands of the original
> 309: * SinglePixelPackedSampleModel/DataBuffer combination.
> 310:
empty line, missing "*"?
test/jdk/java/awt/image/PixelInterleavedSMConstructor.java line 37:
> 35: static final int[] nullbands = null;
> 36: static final int[] zerobands = { };
> 37: static final int[] oneband = { 0 };
might be useful to check band with negative data?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275730423
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275713968
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275722622
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275711387
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275718421
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3275759813