You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Marlis Lamp (JIRA)" <ji...@apache.org> on 2011/03/24 10:27:05 UTC

[jira] [Created] (JCR-2930) same named child nodes disappear on restore

same named child nodes disappear on restore
-------------------------------------------

                 Key: JCR-2930
                 URL: https://issues.apache.org/jira/browse/JCR-2930
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 2.2.4
            Reporter: Marlis Lamp
            Priority: Critical


When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 

            Node node = session.getRootNode().addNode("myNode");
            node.addMixin("mix:versionable");
            for (int i = 1; i < 6; i++) {
                Node child = node.addNode("child");
                child.setProperty("name", "child_"+i);
            }
            session.save();
            VersionManager versionManager = session.getWorkspace().getVersionManager();
            versionManager.checkin(node.getPath());
            System.out.println("number of child nodes: " + node.getNodes().getSize());

            versionManager.checkout(node.getPath());
            node.getNode("child").setProperty("name", "modified");
            session.save();
            Version baseVersion = versionManager.getBaseVersion(node.getPath());
            versionManager.restore(baseVersion, true);
            System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());


produces the following output:

number of child nodes: 5
number of child nodes in restored node: 3

Giving unique names or adding the mixin versionable to the child nodes solves the problem.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Jukka Zitting (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-2930:
-------------------------------

    Fix Version/s:     (was: 2.4)
                   2.3.6
    
> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Assignee: Julian Reschke
>            Priority: Critical
>             Fix For: 2.3.6
>
>         Attachments: JCR-2930.diff, RestoreNodeWithSNSTest.java, VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Marlis Lamp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marlis Lamp updated JCR-2930:
-----------------------------

    Attachment: VersionManagerImplRestore.patch

> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Priority: Critical
>         Attachments: VersionManagerImplRestore.patch, VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (JCR-2930) same named child nodes disappear on restore

Posted by "Julian Reschke (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke resolved JCR-2930.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4

Fixed based on Marlis Lamps patch (thanks!)
                
> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Assignee: Julian Reschke
>            Priority: Critical
>             Fix For: 2.4
>
>         Attachments: JCR-2930.diff, RestoreNodeWithSNSTest.java, VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-2930) same named child nodes disappear on restore

Posted by "Marlis Lamp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011171#comment-13011171 ] 

Marlis Lamp commented on JCR-2930:
----------------------------------

The error occurs at org.apache.jackrabbit.core.version.VersionManagerImplRestore.internalRestoreFrozen(VersionManagerImpl.java:493) when replacing all existing child nodes on N: 

// if node is present, remove it
state.removeNode(entry.getName(), entry.getIndex());

Let N (node) and F (frozen node) have 2 child nodes.
This removes the correct node from the state object at the first cycle, but at the second, when the first child node has been removed from position 1 and added to position 2 on the state object, the indices in the state object have moved and the childnode that has been added at the first cycle is removed at the second cycle. The second cycle also removes the 2nd child node from the state object in line 505:

                // check for existing
                if (f.getFrozenId() != null) {
                    if (stateMgr.hasItemState(f.getFrozenId())) {
                        NodeStateEx existing = state.getNode(f.getFrozenId());
                        if (removeExisting) {
                            NodeStateEx parent = existing.getParent();
                            parent.removeNode(existing);
                            parent.store(); 
                            ...

Finally the 2nd child node of F is added, resulting in a restored state, where the first child node of the frozen node is missing.

> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Priority: Critical
>         Attachments: VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-2930:
--------------------------------

    Attachment: RestoreNodeWithSNSTest.java

repro test case
                
> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Assignee: Julian Reschke
>            Priority: Critical
>         Attachments: RestoreNodeWithSNSTest.java, VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (JCR-2930) same named child nodes disappear on restore

Posted by "Julian Reschke (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke reassigned JCR-2930:
-----------------------------------

    Assignee: Julian Reschke
    
> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Assignee: Julian Reschke
>            Priority: Critical
>         Attachments: VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg updated JCR-2930:
-----------------------------------

    Component/s: versioning

> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Priority: Critical
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Marlis Lamp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marlis Lamp updated JCR-2930:
-----------------------------

    Attachment:     (was: VersionManagerImplRestore.patch)

> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Priority: Critical
>         Attachments: VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (JCR-2930) same named child nodes disappear on restore

Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-2930:
--------------------------------

    Attachment: JCR-2930.diff

proposed patch (minimally changed), includes test case
                
> same named child nodes disappear on restore
> -------------------------------------------
>
>                 Key: JCR-2930
>                 URL: https://issues.apache.org/jira/browse/JCR-2930
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>            Assignee: Julian Reschke
>            Priority: Critical
>         Attachments: JCR-2930.diff, RestoreNodeWithSNSTest.java, VersionManagerImplRestore.patch
>
>
> When restoring a versionable node which has several (non-versionable) child nodes with the same name, some child nodes disappear. 
>             Node node = session.getRootNode().addNode("myNode");
>             node.addMixin("mix:versionable");
>             for (int i = 1; i < 6; i++) {
>                 Node child = node.addNode("child");
>                 child.setProperty("name", "child_"+i);
>             }
>             session.save();
>             VersionManager versionManager = session.getWorkspace().getVersionManager();
>             versionManager.checkin(node.getPath());
>             System.out.println("number of child nodes: " + node.getNodes().getSize());
>             versionManager.checkout(node.getPath());
>             node.getNode("child").setProperty("name", "modified");
>             session.save();
>             Version baseVersion = versionManager.getBaseVersion(node.getPath());
>             versionManager.restore(baseVersion, true);
>             System.out.println("number of child nodes in restored node: "+node.getNodes().getSize());
> produces the following output:
> number of child nodes: 5
> number of child nodes in restored node: 3
> Giving unique names or adding the mixin versionable to the child nodes solves the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira