Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 20453 invoked from network); 13 Sep 2007 14:43:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Sep 2007 14:43:30 -0000 Received: (qmail 47988 invoked by uid 500); 13 Sep 2007 14:43:23 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 47898 invoked by uid 500); 13 Sep 2007 14:43:23 -0000 Mailing-List: contact commits-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 commits@jackrabbit.apache.org Received: (qmail 47889 invoked by uid 99); 13 Sep 2007 14:43:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2007 07:43:23 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2007 14:43:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6009F1A9832; Thu, 13 Sep 2007 07:43:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r575325 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml: SessionImporter.java WorkspaceImporter.java Date: Thu, 13 Sep 2007 14:43:08 -0000 To: commits@jackrabbit.apache.org From: stefan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070913144309.6009F1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stefan Date: Thu Sep 13 07:43:07 2007 New Revision: 575325 URL: http://svn.apache.org/viewvc?rev=575325&view=rev Log: JCR-1128: XML import always throws ItemExistsException when trying to overwrite existing nodes Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=575325&r1=575324&r2=575325&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Thu Sep 13 07:43:07 2007 @@ -202,7 +202,7 @@ QName[] mixins = nodeInfo.getMixinNames(); if (parent == null) { - // parent node was skipped, skip this child node also + // parent node was skipped, skip this child node too parents.push(null); // push null onto stack for skipped node log.debug("skipping node " + nodeName); return; @@ -224,7 +224,14 @@ // this node has already been auto-created, no need to create it node = existing; } else { - throw new ItemExistsException(existing.safeGetJCRPath()); + // edge case: colliding node does have same uuid + // (see http://issues.apache.org/jira/browse/JCR-1128) + if (! (existing.getId().equals(id) + && (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING + || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING))) { + throw new ItemExistsException(existing.safeGetJCRPath()); + } + // fall through } } } Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=575325&r1=575324&r2=575325&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Thu Sep 13 07:43:07 2007 @@ -397,7 +397,7 @@ QName[] mixins = nodeInfo.getMixinNames(); if (parent == null) { - // parent node was skipped, skip this child node also + // parent node was skipped, skip this child node too parents.push(null); // push null onto stack for skipped node succeeded = true; log.debug("skipping node " + nodeName); @@ -429,7 +429,14 @@ // no need to create it node = existing; } else { - throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getNodeId())); + // edge case: colliding node does have same uuid + // (see http://issues.apache.org/jira/browse/JCR-1128) + if (! (idExisting.equals(id) + && (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING + || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING))) { + throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getNodeId())); + } + // fall through } } }