Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 21183 invoked from network); 25 Mar 2011 12:15:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Mar 2011 12:15:46 -0000 Received: (qmail 56638 invoked by uid 500); 25 Mar 2011 12:15:46 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 56595 invoked by uid 500); 25 Mar 2011 12:15:46 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 56588 invoked by uid 99); 25 Mar 2011 12:15:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2011 12:15:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2011 12:15:43 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id DBA9D4D987 for ; Fri, 25 Mar 2011 12:15:05 +0000 (UTC) Date: Fri, 25 Mar 2011 12:15:05 +0000 (UTC) From: "Marlis Lamp (JIRA)" To: dev@jackrabbit.apache.org Message-ID: <1129332390.11039.1301055305896.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <165457980.8073.1300958825745.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (JCR-2930) same named child nodes disappear on restore MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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