From e56fb15f9506d9d2b46bd3f64683f41915b8e91c Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 29 May 2020 13:26:43 +0100 Subject: [PATCH] fixed java.lang.NullPointerException at net.openhft.chronicle.hash.impl.VanillaChronicleHash.isClosed(VanillaChronicleHash.java:687) at net.openhft.chronicle.map.VanillaChronicleMap.longSize(VanillaChronicleMap.java:206) at net.openhft.chronicle.map.AbstractChronicleMap.mapEquals(AbstractChronicleMap.java:183) at net.openhft.chronicle.map.VanillaChronicleMap.equals(VanillaChronicleMap.java:321) at java.util.WeakHashMap.eq(WeakHashMap.java:287) at java.util.WeakHashMap.put(WeakHashMap.java:454) at java.util.Collections$SynchronizedMap.put(Collections.java:2590) at net.openhft.chronicle.core.io.AbstractCloseable.(AbstractCloseable.java:46) at net.openhft.chronicle.hash.impl.VanillaChronicleHash.(VanillaChronicleHash.java:156) --- .../chronicle/hash/impl/VanillaChronicleHash.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java index a42226f62..dd01ed81e 100755 --- a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java @@ -74,10 +74,9 @@ public abstract class VanillaChronicleHash, SC extends // --- Start of instance fields --- /** - * Global mutable state lock doesn't yet need read-write levels and waits; - * Used the same locking strategy as in segment locks - * (VanillaReadWriteUpdateWithWaitsLockingStrategy) in order to simplify Chronicle Map - * specification (having only one kind of locks to specify and implement). + * Global mutable state lock doesn't yet need read-write levels and waits; Used the same locking strategy as in segment locks + * (VanillaReadWriteUpdateWithWaitsLockingStrategy) in order to simplify Chronicle Map specification (having only one kind of locks to specify and + * implement). */ static final LockingStrategy globalMutableStateLockingStrategy = VanillaReadWriteUpdateWithWaitsLockingStrategy.instance(); @@ -684,7 +683,8 @@ public abstract class VanillaChronicleHash, SC extends @Override public boolean isClosed() { - return super.isClosed() || resources.closed(); + ChronicleHashResources resources = this.resources; + return super.isClosed() || (resources != null && resources.closed()); } public final void checkKey(Object key) { @@ -1055,8 +1055,8 @@ public abstract class VanillaChronicleHash, SC extends } /** - * {@link ChronicleHashCloseOnExitHook} needs to use {@code VanillaChronicleHash}es as - * WeakHashMap keys, but with identity comparison, not Map's equals() and hashCode(). + * {@link ChronicleHashCloseOnExitHook} needs to use {@code VanillaChronicleHash}es as WeakHashMap keys, but with identity comparison, not Map's + * equals() and hashCode(). */ public class Identity { public VanillaChronicleHash hash() {