Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1740

RequestCycle.urlFor modifies page parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.4
    • 1.3.5, 1.4-RC1
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            jjviana Juliano Viana
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: