-
Bug
-
Resolution: Done
-
Critical
-
3.4.0.Final
-
None
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.