diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 59ce65c1e..8ce5178f9 100644 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -770,7 +770,16 @@ class VanillaChronicleMap extends AbstractMap 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); }