Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6825

info.magnolia.ui.vaadin.integration.jcr.AbstractJcrAdapter#updateProperties(Item item) seems to be fundamentally broken.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Neutral
    • Resolution: Unresolved
    • Affects Version/s: 5.4.8
    • Fix Version/s: None
    • Component/s: gui
    • Labels:
      None
    • Patch included:
      Yes

      Description

      See this code:

       protected void updateProperties(Item item) throws RepositoryException {
              for (Entry<String, Property> entry : changedProperties.entrySet()) {
                  if (entry.getValue().isReadOnly()) {
                      continue;
                  }
                  updateProperty(item, entry.getKey(), entry.getValue());
                  if (ModelConstants.JCR_NAME.equals(entry.getKey())) {
                      // As the item name has changed - the item must be refreshed to prevent an attempt to change property on an invalid old name.
                      item = getJcrItem();
                  }
              }
          }
      

      The loop changes the parameter (seemingly in the wrong spot too)

      I suppose it wants to be

       
          /**
           * Updates and removes properties on given item, based on the {@link #changedProperties} and {@link #removedProperties} maps. Read-only properties will not be updated and null valued properties will get removed.
           */
          protected void updateProperties(Item item) throws RepositoryException {
              for (Map.Entry<String, Property> entry : changedProperties.entrySet()) {
                  if (entry.getValue().isReadOnly()) {
                      continue;
                  }
                  Item i = item;
                  if (ModelConstants.JCR_NAME.equals(entry.getKey())) {
                      // As the item name has changed - the item must be refreshed to prevent an attempt to change property on an invalid old name.
                      i = getJcrItem();
                  }
      
                  updateProperty(i, entry.getKey(), entry.getValue());
              }
          }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mihxil Michiel Meeuwissen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: