Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-74114 Make Liferay compatible with version 2.0 tests in the Portlet 3.0 TCK
  3. LPS-76161

Portlet 3.0 TCK: PortletPreferences implementation should allow String[] {null} to be set by setValues and correctly retrieved by getValues

    Details

      Description

      Test case failures:

      80 cases defined in the test portlets for V2EnvironmentTests_PortletPreferences_* are failing because of NPE.

      Background:

      There are test cases testing whether a string array with only one null element can be correctly set to the PortletPreferences object and then correctly retrieved using its getValues method.

      For example, in EnvironmentTests_PortletPreferences_ApiEvent_event portlet:

       

      try {
        pp.setValues("TestPreference7", new String[] {null});
        String getVal3[] = pp.getValues("TestPreference7", null);
        if (getVal3[0] == null) { // NPE !!!!!!
          tr19.setTcSuccess(true);
        }
      } catch (IllegalArgumentException iae) {
        tr19.appendTcDetail(iae.toString());
      }
      tr19.writeTo(writer);
      

      However, in Liferay, both null string array and String[] {null} will be saved as String[] {"NULL_VALUE"} via setValues and interpreted back to null when retrieving via getValues. Thus the pp.getValues in the test case will return null, causing NPE in the next line. The portlet will not be correctly rendered, failing all the test cases.

       

        Attachments

          Activity

            People

            Assignee:
            brian.chan Brian Chan
            Reporter:
            dante.wang Dante Wang
            Recent user:
            Csaba Turcsan
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 24 weeks, 6 days ago

                Packages

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