WicketTester can not deal with null values in page parameters
-------------------------------------------------------------
Key: WICKET-1527
URL: https://issues.apache.org/jira/browse/WICKET-1527
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.0-final
Reporter: Hugo Hallman
Priority: Minor
A NullPointerException is thrown when the wicketTester is used to render a page
with a null value in the page parameters, and the page is trying to get the url
of the request.
java.lang.NullPointerException
at java.net.URLEncoder.encode(Unknown Source)
at
org.apache.wicket.protocol.http.MockHttpServletRequest.getQueryString(MockHttpServletRequest.java:691)
at
org.apache.wicket.protocol.http.servlet.ServletWebRequest.getURL(ServletWebRequest.java:368)
at page.constructor();
or myproject.requestcycle.detach();
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1263)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
at
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:382)
at
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:370)
at
org.apache.wicket.util.tester.BaseWicketTester.executeListener(BaseWicketTester.java:248)
at
org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:765)
at
org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:617)
at myproject.test();
The failing code looks like:
final String name =
(String)iterator.next();
final String value =
parameters.getString(name);
buf.append(URLEncoder.encode(name,
"UTF-8"));
buf.append('=');
buf.append(URLEncoder.encode(value,
"UTF-8"));
and fails in URLEncoder.encode(value, utf8).
A proposed solution is to check for null values in the parameter value.
I have not been able to test a later release than 1.3.0, but by inspection, the
same problem still exists.
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java?view=markup
This behaviour is inconsistent with the runtime outside of tester.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.