You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/06/09 08:39:25 UTC

[GitHub] [sling-org-apache-sling-jcr-repoinit] bdelacretaz commented on a change in pull request #19: SLING-10463 - "create path" should fail if a property exists at the same path

bdelacretaz commented on a change in pull request #19:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/19#discussion_r648092308



##########
File path: src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
##########
@@ -142,7 +142,9 @@ public void visitCreatePath(CreatePath cp) {
         for (PathSegmentDefinition psd : cp.getDefinitions()) {
             final String fullPath = parentPath + "/" + psd.getSegment();
             try {
-                if (session.itemExists(fullPath)) {
+                if (session.propertyExists(fullPath)) {
+                    throw new RuntimeException("Error creating Node at " + fullPath + ": a property exists with the same path");
+                } else if (session.itemExists(fullPath)) {
                     log.info("Path already exists, nothing to do (and not checking its primary type for now): {}", fullPath);

Review comment:
       Agreed, I have made that change and also changed the log message to say "Node"




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org