RFR: 6447816: Provider filtering (getProviders) is not working with OR'd conditions [v6]

Weijun Wang weijun at openjdk.org
Thu Sep 8 22:02:11 UTC 2022


On Thu, 8 Sep 2022 19:30:57 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/java/security/Security.java line 610:
>> 
>>> 608:             // return null if the selection criteria is empty; this is to match
>>> 609:             // earlier behavior
>>> 610:             return null;
>> 
>> Is this true? In the original code when `filter` is empty, `keySet` is also empty and `allProviders` will be returned.
>
> Yes, if you look at the original impl (not my earlier changes), the result set is populated inside the loop which iterate over the keys. So, for empty key set, the result set is empty and null will end up being returned. It does not match my expectation. However, I tried it against a clean workspace.

Yes, you're right.

>> src/java.base/share/classes/java/security/Security.java line 873:
>> 
>>> 871:         // whose value may be composite, i.e. multiple values separated by "|"
>>> 872:         private boolean isCompositeValue() {
>>> 873:             return (attrName != null &&
>> 
>> `attrName` is never null when this method is called.
>
> Yes, but that's depending on the current calling pattern. Now that it's inside Criteria class where attrName may be null (for Service.AlgName type of criteria), it should be checked for completeness.

OK.

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

PR: https://git.openjdk.org/jdk/pull/10008



More information about the security-dev mailing list