mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8241248: NullPointerException in sun.security.ssl.HKDF.extract(HKDF.java:93)
Reviewed-by: jnimeh, xuelei
This commit is contained in:
parent
0f925d1f58
commit
1603ca2342
4 changed files with 42 additions and 5 deletions
|
@ -100,6 +100,11 @@ public abstract class Cache<K,V> {
|
|||
*/
|
||||
public abstract void remove(Object key);
|
||||
|
||||
/**
|
||||
* Pull an entry from the cache.
|
||||
*/
|
||||
public abstract V pull(Object key);
|
||||
|
||||
/**
|
||||
* Set the maximum size.
|
||||
*/
|
||||
|
@ -224,6 +229,10 @@ class NullCache<K,V> extends Cache<K,V> {
|
|||
// empty
|
||||
}
|
||||
|
||||
public V pull(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCapacity(int size) {
|
||||
// empty
|
||||
}
|
||||
|
@ -412,6 +421,26 @@ class MemoryCache<K,V> extends Cache<K,V> {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized V pull(Object key) {
|
||||
emptyQueue();
|
||||
CacheEntry<K,V> entry = cacheMap.remove(key);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void setCapacity(int size) {
|
||||
expungeExpiredEntries();
|
||||
if (size > 0 && cacheMap.size() > size) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue