Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2007

Workspace fails to clone direct children of root node

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 3.5.0.Final, 3.3.x-prod-ip6.0
    • 3.4.0.Final
    • JCR
    • None

    Description

      As the title states, direct children of root node cannot be correctly cloned to another workspace.

      This is a small regression introduced while fixing MODE-1972.

      This commit introduces a check for cloning into root node that is slightly incorrect.

      -                // Use the JCR add child here to perform the parent validations
      -                NodeKey cloneKey = parentNode.key().withId(sourceNode.key().getIdentifier());
      -                parentNode.addChildNode(newNodeName, sourceNode.getPrimaryTypeName(), cloneKey, false);
      -
      +                NodeKey cloneKey = null;
      +                if (!parentNode.isRoot()) {
      +                    // Use the JCR add child here to perform the parent validations
      +                    cloneKey = parentNode.key().withId(sourceNode.key().getIdentifier());
      +                    parentNode.addChildNode(newNodeName, sourceNode.getPrimaryTypeName(), cloneKey, false);
      +                } else {
      +                    cloneKey = parentNode.key();
      +                } 
      

      The line

      if (!parentNode.isRoot()) {
      

      changes the behavior not only for cloning the workspace root itself (as was apparently intended), but also for cloning children of workspace root as well.

      The check should be replaced with

      if (!destPath.isRoot()) {
      

      Please find a pull request attached.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            ashelepko Alexander Shelepko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: