RFR: 8376297: ArrayIndexOutOfBoundsException Not Documented for SinglePixelPackedSampleModel.getSampleSize(int) [v3]
Phil Race
prr at openjdk.org
Mon Feb 2 20:01:23 UTC 2026
On Thu, 29 Jan 2026 18:50:42 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8376297
>
> test/jdk/java/awt/image/GetSampleSizeTest.java line 1:
>
>> 1: /*
>
> I suggest creating `test-` methods rather than using a code block inside the `main` method and call the methods from main, it would make the code better structured and convey the intent clearer.
I don't think it needs multiple methods.
I didn't really need to do even the { .. } but it made it easier to make sure of not re-using the var names.
> test/jdk/java/awt/image/GetSampleSizeTest.java line 47:
>
>> 45: ComponentSampleModel csm =
>> 46: new ComponentSampleModel(DataBuffer.TYPE_BYTE,
>> 47: width, height, 1, width, bandOffsets);
>
> Suggestion:
>
> ComponentSampleModel csm =
> new ComponentSampleModel(DataBuffer.TYPE_BYTE,
> width, height, 1, width, bandOffsets);
>
> Indent the continuation lines by 8 spaces which is the standard indentation for continuation lines.
ok
> test/jdk/java/awt/image/GetSampleSizeTest.java line 59:
>
>> 57: MultiPixelPackedSampleModel mppsm =
>> 58: new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
>> 59: width, height, 4);
>
> Suggestion:
>
> MultiPixelPackedSampleModel mppsm =
> new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
> width, height, 4);
>
> Indent the continuation lines by 8 spaces
I removed the line break instead
> test/jdk/java/awt/image/GetSampleSizeTest.java line 72:
>
>> 70: new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
>> 71: width, height, bitMask);
>> 72: int numBands = sppsm.getNumBands();
>
> Suggestion:
>
> SinglePixelPackedSampleModel sppsm =
> new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
> width, height, bitMask);
> int numBands = sppsm.getNumBands();
>
> Indent the continuation lines by 8 spaces; `numBands` isn't a continuation line, and it should align to `SinglePixelPackedSampleModel` declaration.
fixed int numBands, removed line break from the constructor parameter list
> test/jdk/java/awt/image/GetSampleSizeTest.java line 76:
>
>> 74: if (numBands != 4) {
>> 75: throw new RuntimeException("Unexpected numBands");
>> 76: }
>
> Suggestion:
>
> if (numBands != 4) {
> throw new RuntimeException("Unexpected numBands");
> }
>
> Misaligned closing brace.
fixed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743954454
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743950893
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743946838
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743944431
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743940310
More information about the client-libs-dev
mailing list