Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-44701

PortletURLImpl changes internal state during serialization when copying current render parameters

    Details

      Description

      When merging parameters from RenderParametersPool, these parameters are added into local _params store during generateToString() and generateWSRPToString().

      Calling portletURLImpl.toString() multiple times causes the parameters to be duplicated in the serialization output.

      Steps to reproduce:

      1. Go to Control Panel -> Server Administration -> Script console
      2. Execute as Groovy script:
        themeDisplay = actionRequest.getAttribute("LIFERAY_SHARED_THEME_DISPLAY");
        plid = themeDisplay.getPlid();
        
        renderParameters = new java.util.HashMap();
        String[] values = ["test1", "test2"];
        renderParameters.put("test", values);
        com.liferay.portlet.RenderParametersPool.put(com.liferay.portal.util.PortalUtil.getHttpServletRequest(actionRequest), plid, "0", renderParameters);
        
        portletURL = com.liferay.portlet.PortletURLFactoryUtil.create(actionRequest, "0", plid, "RENDER_PHASE");
        portletURL.setCopyCurrentRenderParameters(true);
        out.println(portletURL.toString());
        
        portletURL.clearCache();
        out.println(portletURL.toString());
        
        portletURL.clearCache();
        out.println(portletURL.toString());
        

      Expected result: all 3 URLs are the same
      Actual result example:

      http://localhost:8080/group/control_panel/manage?p_p_id=0&p_p_lifecycle=0&refererPlid=10188&_0_test=test1&_0_test=test2
      http://localhost:8080/group/control_panel/manage?p_p_id=0&p_p_lifecycle=0&refererPlid=10188&_0_test=test1&_0_test=test2&_0_test=test1&_0_test=test2
      http://localhost:8080/group/control_panel/manage?p_p_id=0&p_p_lifecycle=0&refererPlid=10188&_0_test=test1&_0_test=test2&_0_test=test1&_0_test=test2&_0_test=test1&_0_test=test2
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 14 weeks, 4 days ago

                Packages

                Version Package
                7.0.0 DXP FP35
                7.0.0 DXP SP7
                7.0.5 CE GA6
                7.0.X
                Master