On Thu, 25 Aug 2022 19:59:18 GMT, Valerie Peng <[email protected]> wrote:
>> src/java.base/share/classes/java/security/Security.java line 599:
>>
>>> 597: // Returns all installed providers
>>> 598: // if the selection criteria is null.
>>> 599: if ((keySet == null) || (allProviders == null)) {
>>
>> I'm not sure, but can `keySet` or `allProviders` be null? Or you meant
>> `isEmpty()`?
>
> Both may be null as their javadoc didn't state explicitly what is returned.
> This is existing code and it returns null upon empty keySet which I keep the
> same behavior.
> Perhaps for consistency sake, it should also check for the empty keySet
> condition and return allProviders.
Sorry, I re-read and maybe the original check is better. If both `keySet` and
`allProviders` are empty, then empty is returned. According to the spec, it
should be null.
I still don't think either of them can be null, but adding the `isEmpty` check
is probably wrong.
-------------
PR: https://git.openjdk.org/jdk/pull/10008