Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C10E18777 for ; Fri, 27 Nov 2015 21:48:14 +0000 (UTC) Received: (qmail 95869 invoked by uid 500); 27 Nov 2015 21:48:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 95695 invoked by uid 500); 27 Nov 2015 21:48:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 95558 invoked by uid 99); 27 Nov 2015 21:48:12 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Nov 2015 21:48:12 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 44CBF2C1F57 for ; Fri, 27 Nov 2015 21:48:12 +0000 (UTC) Date: Fri, 27 Nov 2015 21:48:12 +0000 (UTC) From: "Thomas Neidhart (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (COLLECTIONS-554) NullPointerException in CollectionUtils.partition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COLLECTIONS-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart closed COLLECTIONS-554. --------------------------------------- > 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.partition((java.lang.Iterable)input, factory, predicates); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)