On Wed, 6 Dec 2023 07:24:08 GMT, Daniel Jeliński <[email protected]> wrote:
>> Anthony Scarpino has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> update
>
> src/java.base/share/classes/com/sun/crypto/provider/AEADBufferedStream.java
> line 60:
>
>> 58: * returning byte[] maybe larger.
>> 59: *
>> 60: * @return internal or new byte array of non-blocksize data.
>
> Please update the doc - the method always returns the internal array.
>
> I would create a new method to retrieve the internal buffer instead of
> overriding `toByteArray`; it would be less surprising to the future code
> editors.
ok
> src/java.base/share/classes/com/sun/crypto/provider/AEADBufferedStream.java
> line 76:
>
>> 74: // Create a new larger buffer and append the new data
>> 75: if (blen < count + len) {
>> 76: buf = Arrays.copyOf(buf, ArraysSupport.newLength(blen, blen
>> + len,
>
> Suggestion:
>
> buf = Arrays.copyOf(buf, ArraysSupport.newLength(blen, count +
> len - blen,
>
> the second parameter is minGrowth; `count+len-blen` would be more appropriate.
Actually it should be `len`. That is the minGrowth as that is the size being
added to the buffer, and `Math.max(len, blen)`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16487#discussion_r1417619875
PR Review Comment: https://git.openjdk.org/jdk/pull/16487#discussion_r1417619918