jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Draier (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-2481) Merge do not detect when a node has been removed and replaced by another one with the same name
Date Tue, 02 Feb 2010 16:10:21 GMT
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


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.


Mime
View raw message