During my investigation, I noticed that Infinispan ignores null values. Maybe I misunderstand the contract of a Map but I thought that if a map implementation doesn't support a null value, it is supposed to throw a NullPointerException otherwise it is supposed to take into account the null value. In case of inifinispan it seems to ignore it which cans be dangerous when we first put a non null value then we try to put a null value, so we believe that the current value is null but in fact it is still the non null value. If it is forbidden we expect a NullPointerException otherwise cache.get should return null, do you agree with my assumption?
I tried the following code with the most common implementations of a Map such as HashMap, ConcurrentHashMap, LinkedHashMap, Properties and WeakHashMap and for all of them the test case described below pass:
The same test case fails with infinispan since null values are ignored. I attached the full Test Case.
Thank you for your answers,
TestNullValue.java.zip 896 bytes