When running in the old-style Coherence cluster, or non-clustered, a Cache object will happily take a null key (when non-clustered, it’s backed by DefaultCache, a wrapper around a plain-old HashMap).
Unfortunately, the Hazelcast backed Cache will not take a null key;
java.lang.NullPointerException: Null key is not allowed!
at com.hazelcast.util.Preconditions.checkNotNull(Preconditions.java:41) ~[?:?]
at com.hazelcast.map.impl.proxy.MapProxyImpl.get(MapProxyImpl.java:79) ~[?:?]
at org.jivesoftware.openfire.plugin.util.cache.ClusteredCache.get(ClusteredCache.j ava:92) ~[?:?]
at org.jivesoftware.util.cache.CacheWrapper.get(CacheWrapper.java:140) ~[openfire.jar:?]
I think that the clustered and non-clustered maps should be consistent; I’m happy to submit a patch request to DefaultCache to reject null keys/values just like the Hazelcat map, if it would (in principle) be accepted.
OK, so it’s a bug in my code that’s triggered this, I just would have found it quicker had the behaviour been consistent between the two Cache implementations.