You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Draier (JIRA)" <ji...@apache.org> on 2010/02/02 17:14:19 UTC

[jira] Updated: (JCR-2481) Merge do not detect when a node has been removed and replaced by another one with the same name

     [ https://issues.apache.org/jira/browse/JCR-2481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Draier updated JCR-2481:
-------------------------------

    Attachment: JCR-2481.patch

proposed patch

> Merge do not detect when a node has been removed and replaced by another one with the same name 
> ------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2481
>                 URL: https://issues.apache.org/jira/browse/JCR-2481
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0.0
>            Reporter: Thomas Draier
>         Attachments: JCR-2481.patch
>
>
> Hi,
> When using VersionManager.merge() to merge modification from one workspace to another, with shallow set to true , node deletion/creation is ignored if one node has been deleted and another node created with the same name. Actually, the check done in internalMerge does only checks for every child that the corresponding node has a child with the same name. If shallow is set to false, internalMerge will be called on two nodes which do not share the same history , which result in a failed merge.
> The code : ( VersionManagerImplMerge:170 )
>         // remove the child nodes in N but not in N'
>         LinkedList<ChildNodeEntry> toDelete = new LinkedList<ChildNodeEntry>();
>         for (ChildNodeEntry entry: state.getState().getChildNodeEntries()) {
>             if (!srcNode.getState().hasChildNodeEntry(entry.getName(), entry.getIndex())) {
>                 toDelete.add(entry);
>             }
>         }
> could be replaced by :         
>         // remove the child nodes in N but not in N'
>         LinkedList<ChildNodeEntry> toDelete = new LinkedList<ChildNodeEntry>();
>         for (ChildNodeEntry entry: state.getState().getChildNodeEntries()) {
>             if (!srcNode.getState().hasChildNodeEntry(entry.getName(), entry.getIndex()) || !srcNode.getState().hasChildNodeEntry(entry.getId())) {
>                 toDelete.add(entry);
>             }
>         }
> In order to reproduce, 
> - create one node A with a sub node B in workspace ws1
> - clone to a second workspace ws2 
> - remove node B in ws1
> - add a new node B under A in ws1 
> - Call ws2versionManager.merge(ws1, A, true, true) - node B is not updated . 
> Regards

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.