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

LocalizationUtil Method for returning portlet preference values does not respect defaultValue parameter

    Details

      Description

      Description

      The order of the parameters called is not correct within the configuration values from the method: 

      LocalizationUtil.getLocalizationXmlFromPreferences

      On 6.2, this method would return the value passed in the parameter defaultValue if the portlet preferences were empty. In 7.0, 7.1, and master, the method now gives back the string "null", leading to incorrect text being displayed (see screenshot).

      Steps to Reproduce

      1) Navigate to Control Panel > Configuration > Server Administration
      2) Click Script, and enter the following groovy script into the console:

      defaultValue =  com.liferay.portal.kernel.util.LocalizationUtil.getLocalizationXmlFromPreferences(preferences, actionRequest, "test", "testvalue");
      out.println(defaultValue);

      Results of Testing

      Expected Behavior: Script returns the value "testValue"
      Actual Behavior: Script returns "null." Order of parameters is not correct, as defaultValue is passed into the wrong parameter.

      Master

      Reproduced.
      77c92453dc0c04de0013e1ca1e996fdd358d686f

      Branch

      Reproduced.
      487ddea1c24b1e464975e869387094b999215ec5

        Attachments

          Activity

            People

            • Assignee:
              sharry.shi Sharry Shi
              Reporter:
              diana.lin Diana Lin
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                34 weeks, 5 days ago

                Packages

                Version Package
                7.0.0 DXP FP70
                7.0.X
                7.1.10 DXP FP6
                7.1.10.2 SP2
                7.1.3 CE GA4
                7.1.X
                Master