-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Invalid
-
Affects Version/s: 4.1
-
Fix Version/s: None
-
Component/s: Collection
-
Labels:None
NullPointerException (NPE) is not suitably handled in CollectionUtils.partition. With a nullFactory, partitions.get(numberOfPredicates) can be null at line partitions.get(numberOfPredicates).add(element);.
Stack trace:
test(Test)java.lang.NullPointerException at org.apache.commons.collections4.CollectionUtils.partition(CollectionUtils.java:1187) at Test.test(Test.java:18)
Test case:
public void test() { Collection input = CollectionUtils.permutations((java.util.Collection)new CircularFifoQueue(10)); Factory factory = FactoryUtils.nullFactory(); NullIsFalsePredicate p = new NullIsFalsePredicate(NullPredicate.nullPredicate()); Predicate[] predicates = p.getPredicates(); CollectionUtils.<java.lang.Object,java.util.Collection>partition((java.lang.Iterable)input, factory, predicates); }