RFR: 8340327: A common framework to support public key algorithms with standard parameter sets [v6]
Weijun Wang
weijun at openjdk.org
Fri Oct 4 17:51:41 UTC 2024
On Fri, 4 Oct 2024 16:21:56 GMT, Kevin Driver <kdriver at openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/provider/NamedKEM.java line 62:
>>
>>> 60: this.fname = Objects.requireNonNull(fname);
>>> 61: if (pnames == null || pnames.length == 0) {
>>> 62: throw new AssertionError("pnames cannot be null or empty");
>>
>> Only curious: why `AssertionError` here instead of `IllegalArgumentException` or `InvalidParameterException`?
>
> See also: checking the `spec` parameter in `engineNewEncapsulator`, which does use `InvalidParameterException`.
We only have child classes inside JDK, therefore if the convention is not followed, it's treated as a programming error. In other cases when the input argument are from users we need to be prepared for any invalid input and we treat them as runtime exceptions.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21167#discussion_r1788080720
More information about the security-dev
mailing list