On Thu, 8 Sep 2022 14:25:06 GMT, Weijun Wang <[email protected]> wrote:

>> Valerie Peng has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   More refactoring
>
> 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.

> 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.

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

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

Reply via email to