jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r158441 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
Date Mon, 21 Mar 2005 10:27:42 GMT
Author: stefan
Date: Mon Mar 21 02:27:41 2005
New Revision: 158441

URL: http://svn.apache.org/viewcvs?view=rev&rev=158441
Log:
JCR-31 sysview import cannot handle auto-created nodes
(fixing bug in bug fix ;)

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java?view=diff&r1=158440&r2=158441
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
Mon Mar 21 02:27:41 2005
@@ -164,7 +164,7 @@
 
         // process node
 
-        NodeImpl node;
+        NodeImpl node = null;
         String uuid = nodeInfo.getUUID();
         QName nodeName = nodeInfo.getName();
         QName ntName = nodeInfo.getNodeTypeName();
@@ -180,20 +180,26 @@
             // a node with that name already exists...
             NodeImpl existing = parent.getNode(nodeName);
             NodeDef def = existing.getDefinition();
-            if (def.isProtected() && existing.isNodeType(ntName)) {
-                // skip protected node
-                parents.push(null); // push null onto stack for skipped node
-                log.debug("skipping protected node " + existing.safeGetJCRPath());
-                return;
+            if (!def.allowSameNameSibs()) {
+                // existing doesn't allow same-name siblings,
+                // check for potential conflicts
+                if (def.isProtected() && existing.isNodeType(ntName)) {
+                    // skip protected node
+                    parents.push(null); // push null onto stack for skipped node
+                    log.debug("skipping protected node " + existing.safeGetJCRPath());
+                    return;
+                }
+                if (def.isAutoCreate() && existing.isNodeType(ntName)) {
+                    // this node has already been auto-created, no need to create it
+                    node = existing;
+                } else {
+                    throw new ItemExistsException(existing.safeGetJCRPath());
+                }
             }
-            if (def.isAutoCreate() && existing.isNodeType(ntName)) {
-                // this node has already been auto-created, no need to create it
-                node = existing;
-            } else {
-                throw new ItemExistsException(existing.safeGetJCRPath());
-            }
-        } else {
-            // there's no node with that name...
+        }
+
+        if (node == null) {
+            // create node
             if (uuid == null) {
                 // no potential uuid conflict, always add new node
                 node = createNode(parent, nodeName, ntName, mixins, null);



Mime
View raw message