HHH-13645 : StatsNamedContainer#getOrCompute throws NullPointerException when computed value is null

This commit is contained in:
Gail Badner 2019-09-27 15:32:25 -07:00 committed by Sanne Grinovero
parent 3f7d03bfec
commit 00d25c1824
1 changed files with 9 additions and 4 deletions

View File

@ -71,12 +71,17 @@ final class StatsNamedContainer<V> {
}
else {
final V v2 = function.apply( key );
final V v3 = map.putIfAbsent( key, v2 );
if ( v3 == null ) {
return v2;
if ( v2 == null ) {
return null;
}
else {
return v3;
final V v3 = map.putIfAbsent( key, v2 );
if ( v3 == null ) {
return v2;
}
else {
return v3;
}
}
}
}