On Wed, 26 Apr 2023 20:21:49 GMT, Sean Mullan <mul...@openjdk.org> wrote:

>> Weijun Wang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   no more pk/sk, AIOOBE to IOOBE
>
> src/java.base/share/classes/javax/crypto/KEM.java line 606:
> 
>> 604:      * @param publicKey the receiver's public key, must not be {@code 
>> null}
>> 605:      * @return the encapsulator for this key
>> 606:      * @throws InvalidKeyException if {@code publicKey} is invalid
> 
> What about throwing `NullPointerException` if `publicKey` is `null`? In this 
> case a `RuntimeException` seems more appropriate, and throwing NPE seems more 
> consistent with how you treat `null` parameters of other methods.

Every other crypto engine class throws IKE when initing with a null key, 
including `Signature`, `Cipher`, `KeyAgreement`, 'Mac`. So I follow the same 
style.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13256#discussion_r1178371353

Reply via email to