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

Martin Grigorov updated WICKET-1876:
------------------------------------

    Attachment: WICKET-1876.patch.txt

It seems that RequestUtils.decodeUrlParameters(String, Map) does the right 
thing. It is the same as RequestUtils.decodeParameters(String, ValueMap) but 
makes the right thing with the values.

The attached patch replaces all usages of decodeParameters() with 
decodeUrlParameters().
It does solve my problem.

Run the tests after applying it because they fail locally (but this could be 
caused by other changed files here...).

> RequestUtils.decodeParameters(String, ValueMap) doesn't follow the Servlet 
> spec
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-1876
>                 URL: https://issues.apache.org/jira/browse/WICKET-1876
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: Any
>            Reporter: Martin Grigorov
>         Attachments: WICKET-1876.patch.txt
>
>
> RequestUtils.decodeParameters(String, ValueMap) (and probably 
> RequestUtils.decodeUrlParameters(String, Map)) fills a (Value)Map with values 
> of type java.lang.String while it
> has to fill values of type String[] because by Servlet API 
> java.servlet.ServletRequest.getParameterValues(String) returns String[].
> How I get to this: 
> mockHttpServletRequest.setUrl("http://dummy.com?param1=value1";) -> this calls 
> RequestUtils.decodeParameters(queryString, parameters);
> Later when I do mockHttpServletRequest.getParameterMap() and iterate over it 
> I expect the values to be of type String[].
> A trivial (and wrong) fix would be to put "new String[] {currentValue}" in 
> the map. The proper fix is to collect all values per parameter name and 
> create an array of them. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to