jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
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 GMT
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
                     }
                 }
             }



Mime
View raw message