commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (COLLECTIONS-513) NullPointerException in SwitchTransformer.transform
Date Thu, 10 Apr 2014 20:30:16 GMT

     [ https://issues.apache.org/jira/browse/COLLECTIONS-513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart resolved COLLECTIONS-513.
-----------------------------------------

    Resolution: Invalid

This is not a bug.

The constructor of SwitchTransformer states that the array of predicates must not contain
null values:

{noformat}
     * @param predicates  array of predicates, cloned, no nulls
{noformat}

but the provided array of predicates is an array with one null value.

I think the way these tests are created are flawed:

{noformat}
        org.apache.commons.collections4.set.CompositeSet var1 = new org.apache.commons.collections4.set.CompositeSet(
                var0);
        org.apache.commons.collections4.functors.UniquePredicate var2 = new org.apache.commons.collections4.functors.UniquePredicate();
        org.apache.commons.collections4.Predicate[] var3 = new org.apache.commons.collections4.Predicate[]
{ var2 };
        java.lang.Object[] var4 = var1.toArray((java.lang.Object[]) var3);
{noformat}

Here var1 is an empty set, whose contents are copied into an object array var4. But the toArray()
method is called with an non-empty array, which will be modified by the toArray() call and
result in this 1-element array with a null value.

I fail to see what this tries to test, as the result of this operation will be in any case
wrong

> NullPointerException in SwitchTransformer.transform
> ---------------------------------------------------
>
>                 Key: COLLECTIONS-513
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-513
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Functor
>    Affects Versions: 4.0
>         Environment: Mac OS 10.9, Java 6 and Java 7
>            Reporter: Cyrille Artho
>         Attachments: BugReport2.java
>
>
> A relatively complex test case generated by Randoop results in a NullPointerException
in SwitchTransformer.transform.
> I'm not sure if this is an incorrect usage of the method, or if it is a real bug.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message