RFR: 6205692: (spec) javax.crypto.MacSpi.engineUpdate(ByteBuffer input): NPE should be specified

Kevin Driver kdriver at openjdk.org
Fri Aug 12 19:11:19 UTC 2022


On Fri, 12 Aug 2022 18:47:21 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> add @exception message to indicate an NPE might be thrown when the input parameter is null
>
> src/java.base/share/classes/javax/crypto/MacSpi.java line 105:
> 
>> 103:      * @param input the ByteBuffer
>> 104:      *
>> 105:      * @exception NullPointerException if {@code input} is null
> 
> nit: I recall @throws is preferred.
> 
> How about the update(...) methods in javax.crypto.Mac class? Perhaps the NPE there should be documented as well?

@valeriepeng I totally agree about `@throws`. I was just going for consistency within the file. There are other `@exception` appearances.

Yes, I do agree about the `update(ByteBuffer)` in Mac as well; however this one throws `IllegalArgumentException` if the parameter is null. Or were you referring to another version of the `update` method?

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

PR: https://git.openjdk.org/jdk/pull/9859



More information about the security-dev mailing list