You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/08/24 06:20:31 UTC

svn commit: r688443 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java

Author: cziegeler
Date: Sat Aug 23 21:20:29 2008
New Revision: 688443

URL: http://svn.apache.org/viewvc?rev=688443&view=rev
Log:
Allow null for the node types.

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java?rev=688443&r1=688442&r2=688443&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java Sat Aug 23 21:20:29 2008
@@ -249,8 +249,8 @@
      * will be created with the given nodeType
      *
      * @param path to create
-     * @param intermediateNodeType to use for creation of intermediate nodes
-     * @param nodeType to use for creation of the final node
+     * @param intermediateNodeType to use for creation of intermediate nodes (or null)
+     * @param nodeType to use for creation of the final node (or null)
      * @param session to use
      * @param autoSave Should save be called when a new node is created?
      * @return the Node at path
@@ -274,7 +274,11 @@
                     final String token = st.nextToken();
                     if ( !node.hasNode(token) ) {
                         try {
-                            node.addNode(token, intermediateNodeType);
+                            if ( intermediateNodeType != null ) {
+                                node.addNode(token, intermediateNodeType);
+                            } else {
+                                node.addNode(token);
+                            }
                             if ( autoSave ) node.save();
                         } catch (RepositoryException re) {
                             // we ignore this as this folder might be created from a different task
@@ -286,7 +290,11 @@
                 path = path.substring(pos + 1);
             }
             if ( !node.hasNode(path) ) {
-                node.addNode(path, nodeType);
+                if ( nodeType != null ) {
+                    node.addNode(path, nodeType);
+                } else {
+                    node.addNode(path);
+                }
                 if ( autoSave ) node.save();
             }
             return node.getNode(path);