RequestCycle.urlFor modifies page parameters
--------------------------------------------

                 Key: WICKET-1740
                 URL: https://issues.apache.org/jira/browse/WICKET-1740
             Project: Wicket
          Issue Type: Bug
    Affects Versions: 1.3.4
            Reporter: Juliano Viana


The method RequestCycle.urlFor(final Component component,final 
RequestListenerInterface listener, ValueMap params) (RequestCycle.java line 
824) obtains a PageParameters instance from the current page or creates a new 
instance if the page has no associated PageParameters. It then proceeds to add 
to the PageParameters instance all the parameters passed on the 'params' 
argument. If its using the PageParameters instance associated with the current 
Page that means the parameters of the page are permanently altered and any code 
later in the request cycle that depends upon these parameters is going to be 
broken. 
I believe the soluction would be to clone the PageParameters instance obtained 
from the Page, as in:

        PageParameters pageParameters = page.getPageParameters();
                        if (pageParameters == null)
                        {
                                pageParameters = new PageParameters();
                        }
                        else
                                pageParameters = 
(PageParameters)pageParameters.clone();

The above change doesn't seem to break any test cases.





-- 
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