You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2017/03/06 07:53:32 UTC
[jira] [Assigned] (WICKET-6332) NullPointerException in
PageParameters#equals()
[ https://issues.apache.org/jira/browse/WICKET-6332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov reassigned WICKET-6332:
---------------------------------------
Assignee: Martin Grigorov
> 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
>
> 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
(v6.3.15#6346)