You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "M Kim (JIRA)" <ji...@apache.org> on 2015/02/16 17:35:11 UTC
[jira] [Updated] (COLLECTIONS-554) NullPointerException in
CollectionUtils.partition
[ https://issues.apache.org/jira/browse/COLLECTIONS-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
M Kim updated COLLECTIONS-554:
------------------------------
Description:
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:
{code}
test(Test)java.lang.NullPointerException
at org.apache.commons.collections4.CollectionUtils.partition(CollectionUtils.java:1187)
at Test.test(Test.java:18)
{code}
Test case:
{code}
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);
}
{code}
was:
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);.
Tracetrace:
{code}
test(Test)java.lang.NullPointerException
at org.apache.commons.collections4.CollectionUtils.partition(CollectionUtils.java:1187)
at Test.test(Test.java:18)
{code}
Test case:
{code}
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);
}
{code}
> NullPointerException in CollectionUtils.partition
> -------------------------------------------------
>
> Key: COLLECTIONS-554
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-554
> Project: Commons Collections
> Issue Type: Bug
> Components: Collection
> Affects Versions: 4.1
> Reporter: M Kim
> Priority: Minor
>
> 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:
> {code}
> test(Test)java.lang.NullPointerException
> at org.apache.commons.collections4.CollectionUtils.partition(CollectionUtils.java:1187)
> at Test.test(Test.java:18)
> {code}
> Test case:
> {code}
> 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);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)