RFR: 8360463: Ambiguity in Cipher.getInstance() specification between NoSuchAlgorithmException and NoSuchPaddingException [v8]

Sean Mullan mullan at openjdk.org
Thu Sep 18 21:06:38 UTC 2025


On Thu, 18 Sep 2025 20:41:14 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/javax/crypto/Cipher.java line 507:
>> 
>>> 505:      *
>>> 506:      * @throws NoSuchAlgorithmException if {@code transformation}
>>> 507:      *         is {@code null}, empty, in an invalid format,
>> 
>> Not related to this change, but do we need an "or" before "in an valid format"?
>
> Hmm, how about this?
> 
> @throws NoSuchAlgorithmException if {@code transformation}
>         is {@code null}, empty or in an invalid format,
>         or if a {@code CipherSpi} implementation is not found or
>         is found but does not support the mode

A semi-colon (instead of a comma) after "format" might also help separate the 2 main error conditions:


@throws NoSuchAlgorithmException if {@code transformation}
        is {@code null}, empty or in an invalid format;
        or if a {@code CipherSpi} implementation is not found or
        is found but does not support the mode

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26489#discussion_r2361194887


More information about the security-dev mailing list