RiCache.getAll checks the argument "keys" with keys.contains(null). This check throws a NulllPointerException irrespective of the actual sets elements if the java.util.Set Implementation won't accept null as an element.
|
if (keys.contains(null)) { |
java.util.Set.contains documents that the method will throw a NullPointerException "if the specified element is null and this set does not permit null elements". Such Set can easily be obtained by a call to java.util.Collections.unmodifiableSet() or from objects of TreeSet (and possibly other implementations).
Ensuring that the argument "keys" won't contain any null elements should certainly throw a NullPointerException only if the Set happens to actually contain some null-Elements.
RiCache.getAll checks the argument "keys" with keys.contains(null). This check throws a NulllPointerException irrespective of the actual sets elements if the java.util.Set Implementation won't accept null as an element.
RI/cache-ri-impl/src/main/java/org/jsr107/ri/RICache.java
Line 420 in 94b2c5d
java.util.Set.contains documents that the method will throw a NullPointerException "if the specified element is null and this set does not permit null elements". Such Set can easily be obtained by a call to java.util.Collections.unmodifiableSet() or from objects of TreeSet (and possibly other implementations).
Ensuring that the argument "keys" won't contain any null elements should certainly throw a NullPointerException only if the Set happens to actually contain some null-Elements.