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

Can't edit fields in document, if document type changes

    Details

      Description

      Steps to reproduce

      1. Go to content and media and upload an arbitrary document
      2. Create a new document type with a simple text field
      3. Open the previously added document and change to the new type

      Expected result
      The field is visible.

      Actual result
      The field is not visible and the log shows:

      java.lang.ArrayIndexOutOfBoundsException: 0
      	at com.liferay.portlet.dynamicdatamapping.util.DDMXSDImpl.countFieldRepetition(DDMXSDImpl.java:578) [portal-impl.jar:]
      	at com.liferay.portlet.dynamicdatamapping.util.DDMXSDImpl.getFieldHTML(DDMXSDImpl.java:146) [portal-impl.jar:]
      	at com.liferay.portlet.dynamicdatamapping.util.DDMXSDImpl.getHTML(DDMXSDImpl.java:251) [portal-impl.jar:]
      	at com.liferay.portlet.dynamicdatamapping.util.DDMXSDImpl.getHTML(DDMXSDImpl.java:310) [portal-impl.jar:]
      	at com.liferay.portlet.dynamicdatamapping.util.DDMXSDUtil.getHTML(DDMXSDUtil.java:112) [portal-service.jar:]
      	at org.apache.jsp.html.taglib.ddm.html.start_jsp._jspService(start_jsp.java:612)
      ...
      

      Apparently the countFieldRepetition is not working if the given array is empty.

      Fix

      DDMXSDImpl.java
        protected int countFieldRepetition(
            String[] fieldsDisplayValues, String parentFieldName, int offset) {
          if (offset >= fieldsDisplayValues.length) {
            return 0;
          }
          ...
        }
      

        Attachments

          Activity

            People

            • Assignee:
              victor.ware Victor Ware
              Reporter:
              starrunner Tobias Liefke
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 13 weeks, 5 days ago

                Packages

                Version Package
                6.2.0 CE GA1