RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v10]

Valerie Peng valeriep at openjdk.org
Thu Aug 8 19:33:36 UTC 2024


On Thu, 8 Aug 2024 01:48:27 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/javax/crypto/KDF.java line 253:
>> 
>>> 251:     public static KDF getInstance(String algorithm, String provider)
>>> 252:         throws NoSuchAlgorithmException, NoSuchProviderException {
>>> 253:         Objects.requireNonNull(provider, "provider may not be null");
>> 
>> nit: may=>should?
>
> Same goes for other {@code Object.requireNonNull()} calls

Why do the null check on {@code provider} here? For consistency sake, since both {@code algorithm} and {@code provider} are checked for non-null inside {@code getInstance(String, KDFParameters, String), you should either check both for non-null or leave it to the 3-arg getInstance() call.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1710157587



More information about the security-dev mailing list