On Mon, 13 Apr 2026 17:17:40 GMT, Phil Race <[email protected]> wrote:

>> This fix updates DataBuffer subclasses to actually adhere to their stated 
>> specifications by rejecting certain invalid parameters for constructors and 
>> getters and setters.
>> A new egression test for each of the constructor and getter/setter cases is 
>> supplied.
>> 
>> No existing regression tests fail with this change, and standard demos work.
>> 
>> Problems caused by these changes are most likely to occur if the client has 
>> a bug such that 
>> - a client uses the constructors that accept an array and then supplies a 
>> "size" that is greater than the array.
>> - a client uses the constructors that accept an array and then supplies a 
>> "size" that is less than the array and then uses getter/setters that are 
>> within the array but outside the range specified by size. 
>> 
>> Since very few clients (and just one case in the JDK that I found) even use 
>> these array constructors the changes are unlikely to make a difference to 
>> clients.
>> 
>> The CSR is ready for review https://bugs.openjdk.org/browse/JDK-8378116
>> 
>> ---------
>> - [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:
> 
>   8377568

Changes requested by aivanov (Reviewer).

src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java line 118:

> 116:      * @throws NullPointerException if {@code dataArray} is {@code null}.
> 117:      * @throws IllegalArgumentException if {@code size} is less than or 
> equal
> 118:      *         to zero or is greater than the length of {@code 
> dataArray}.

Suggestion:

     * @throws IllegalArgumentException if {@code size} is less than or equal
     *         to zero, or is greater than the length of {@code dataArray}.

A comma is missing here.

src/java.desktop/share/classes/java/awt/image/DataBufferInt.java line 121:

> 119:      * @throws NullPointerException if {@code dataArray} is {@code null}.
> 120:      * @throws IllegalArgumentException if {@code size} is less than or 
> equal
> 121:      *         to zero or is greater than the length of {@code 
> dataArray}.

Suggestion:

     * @throws IllegalArgumentException if {@code size} is less than or equal
     *         to zero, or is greater than the length of {@code dataArray}.

src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java line 122:

> 120:      * @throws NullPointerException if {@code dataArray} is {@code null}.
> 121:      * @throws IllegalArgumentException if {@code size} is less than or 
> equal
> 122:      *         to zero or is greater than the length of {@code 
> dataArray}.

Suggestion:

     * @throws IllegalArgumentException if {@code size} is less than or equal
     *         to zero, or is greater than the length of {@code dataArray}.

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

PR Review: https://git.openjdk.org/jdk/pull/29766#pullrequestreview-4114605754
PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r3087391308
PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r3087403868
PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r3087410261

Reply via email to