On Mon, 27 Apr 2026 21:16:04 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

Left some observations..I will approve if those are seen to be not a problem..

src/java.desktop/share/classes/java/awt/image/PixelInterleavedSampleModel.java 
line 82:

> 80:      *         one of the supported data types
> 81:      * @throws NullPointerException if {@code bandOffsets} is {@code null}
> 82:      * @throws IllegalArgumentException if {@code bandOffsets.length} is 0

It is mentioned

if (numBands <= 0) {
            throw new IllegalArgumentException("Number of bands must be > 0");
        }

so maybe `@throws IllegalArgumentException if {@code bandOffsets.length} is not 
greater than 0` is more apt
but I see ComponentSampleModel the superclass of this, also mentioned the same 
although its superclass SampleModel mentioned
`@throws IllegalArgumentException if {@code numBands} is less than 1`

src/java.desktop/share/classes/java/awt/image/PixelInterleavedSampleModel.java 
line 161:

> 159:      * @throws IllegalArgumentException if the number of bands is not 
> greater than 0
> 160:      * @throws RasterFormatException if the number of bands is greater 
> than
> 161:      *                               the number of banks in this sample 
> model.

Is it "number of banks"? Below it is checking for `bandOffsets.length` so 
shouldn't it be
`@throws RasterFormatException if the number of bands is greater than {@code 
bandOffsets.length}`

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

PR Review: https://git.openjdk.org/jdk/pull/30902#pullrequestreview-4225234575
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3186002625
PR Review Comment: https://git.openjdk.org/jdk/pull/30902#discussion_r3186015595

Reply via email to