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

Infinite loop when updating web content with sub structure

    Details

      Description

      It's impossible save web contents that uses substructures.
      Steps to reproduce it:
      1 - create a structure "person"
      2 - create a substructure "Male"
      3 - create a new web content using "Male" structure

      when you publish it, LR create an infinite loop.
      The problem is in the method hasField of DDMStructureImpl class.

      @Override
      public boolean hasField(String fieldName)
      throws PortalException, SystemException {

      Map<String, Map<String, String>> fieldsMap = getFieldsMap();

      boolean hasField = fieldsMap.containsKey(fieldName);

      while (!hasField && (getParentStructureId() > 0))

      { DDMStructure parentStructure = DDMStructureLocalServiceUtil.getStructure( getParentStructureId()); hasField = parentStructure.hasField(fieldName); }

      return hasField;
      }

      The problem is the while iteration.
      In my installation I substituted it with this:

      @Override
      public boolean hasField(String fieldName)
      throws PortalException, SystemException {

      Map<String, Map<String, String>> fieldsMap = getFieldsMap();

      boolean hasField = fieldsMap.containsKey(fieldName);

      if ((!hasField) && (getParentStructureId() > 0))

      { DDMStructure parentStructure = DDMStructureLocalServiceUtil.getStructure( getParentStructureId()); return parentStructure.hasField(fieldName); }

      return hasField;
      }

      Is it coorect ?

      Thanks.

        Attachments

        1. fix.jpg
          fix.jpg
          52 kB
        2. male template configuration.PNG
          male template configuration.PNG
          16 kB
        3. reproduce.jpg
          reproduce.jpg
          83 kB

          Issue Links

            Activity

              People

              Assignee:
              lu.liu Lu Liu
              Reporter:
              riccardo Riccardo Martini
              Participants of an Issue:
              Recent user:
              Brian Wulbern
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 25 weeks, 2 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 M1