RFR: 8241248: NullPointerException in sun.security.ssl.HKDF.extract(HKDF.java:93) [v3]

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Sat May 8 19:52:10 UTC 2021


On Sat, 8 May 2021 19:10:50 GMT, Alexey Bakhtin <abakhtin at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/util/Cache.java line 442:
>> 
>>> 440:         entry.invalidate();
>>> 441:         return value;
>>> 442:     }
>> 
>> I may adjust the lines a little bit so as to avoid duplicated operations (see the implementation code of isValid()).
>> 
>> 
>>          long time = (lifetime == 0) ? 0 : System.currentTimeMillis();
>>          if (entry.isValid(time)) {
>>               V value = entry.getValue();
>>               entry.invalidate();
>>               return value;
>>           } else {
>>               if (DEBUG) {
>>                   System.out.println("Ignoring expired entry");
>>               }
>>               return null;
>>           }
>
> I'd like to keep my code as-is. We still need invalidate() if entry is not valid (see remove() operation).

Did you notice that entry.isValid() implementation has already call invalidate() if the entry is not valid?

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

PR: https://git.openjdk.java.net/jdk/pull/3664



More information about the security-dev mailing list