mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Ensure acquireUsing() doesn't return null
This commit is contained in:
@@ -770,7 +770,16 @@ class VanillaChronicleMap<K, V> extends AbstractMap<K, V>
|
||||
return usingValue;
|
||||
} else {
|
||||
try {
|
||||
return valueFactory.create();
|
||||
usingValue = valueFactory.create();
|
||||
if (usingValue == null) {
|
||||
throw new IllegalStateException("acquireUsing() method requires" +
|
||||
"valueFactory.create() result to be non-null. " +
|
||||
"By default it is so when value class is" +
|
||||
"a Byteable/BytesMarshallable/Externalizable subclass." +
|
||||
"Note that acquireUsing() anyway makes very little sense " +
|
||||
"when value class is not a Byteable subclass.");
|
||||
}
|
||||
return usingValue;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user