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

Martin Grigorov updated WICKET-6332:
------------------------------------
    Fix Version/s: 7.7.0

> NullPointerException in PageParameters#equals()
> -----------------------------------------------
>
>                 Key: WICKET-6332
>                 URL: https://issues.apache.org/jira/browse/WICKET-6332
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.6.0, 8.0.0-M4
>            Reporter: Alexey Grigorovitch
>            Assignee: Martin Grigorov
>            Priority: Major
>             Fix For: 7.7.0, 8.0.0-M9
>
>
> Comparing an instance of {{PageParameters}} with some parameters set to an 
> empty {{PageParameters}} instance results in a NullPointerException.
> This bug was introduced by WICKET-6283 where collection equality was replaced 
> by {{CollectionUtils.isEmptyCollection()}}. The latter API expects both 
> arguments to be non-null, while the former accepts nulls.
> Test case:
> {code}
>       /**
>          * namedParameters equality should handle null namedParameters 
> instance.
>        */
>       @Test
>       public void equalityWithEmptyParameters()
>       {
>               PageParameters p1 = new PageParameters()
>                               .add("a", "b");
>               PageParameters p2 = new PageParameters();
>               assertThat(p1, is(not(equalTo(p2))));
>       }
> {code}
> Output:
> {noformat}
> java.lang.NullPointerException
>       at 
> org.apache.commons.collections4.CollectionUtils.isEqualCollection(CollectionUtils.java:515)
>       at 
> org.apache.wicket.request.mapper.parameter.PageParameters.equals(PageParameters.java:470)
>       at org.hamcrest.core.IsEqual.areEqual(IsEqual.java:40)
>       at org.hamcrest.core.IsEqual.matches(IsEqual.java:23)
>       at org.hamcrest.core.IsNot.matches(IsNot.java:22)
>       at org.hamcrest.core.Is.matches(Is.java:26)
>       at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:10)
>       at org.junit.Assert.assertThat(Assert.java:956)
>       at org.junit.Assert.assertThat(Assert.java:923)
>       at 
> org.apache.wicket.request.mapper.parameter.PageParametersTest.equalityWithEmptyParameters(PageParametersTest.java:328)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to