You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2023/01/26 11:39:47 UTC

[jackrabbit-oak] branch trunk updated: OAK-10087: TypeEditor: constraint exception for invalid child node should contain that node's effective type (#835)

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 09191a20f2 OAK-10087: TypeEditor: constraint exception for invalid child node should contain that node's effective type (#835)
09191a20f2 is described below

commit 09191a20f275221fb7986f80d3557abc6ddcd619
Author: Julian Reschke <re...@apache.org>
AuthorDate: Thu Jan 26 12:39:39 2023 +0100

    OAK-10087: TypeEditor: constraint exception for invalid child node should contain that node's effective type (#835)
---
 .../jackrabbit/oak/plugins/nodetype/TypeEditor.java       | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java
index 8f73af0ad5..d3f2f94f81 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java
@@ -464,27 +464,26 @@ public class TypeEditor extends DefaultEditor {
         }
         // verify the presence of all mandatory items
         if (!properties.isEmpty()) {
-            constraintViolation(21, "Mandatory property " + properties.iterator().next() + " not found in a new node");
+            constraintViolation(21, "Mandatory property '" + properties.iterator().next() + "' not found in a new node");
         }
 
         List<String> names = Lists.newArrayList(after.getChildNodeNames());
         for (String child : effective.getMandatoryChildNodes()) {
             if (!names.remove(child)) {
-                constraintViolation(25, "Mandatory child node " + child + " not found in a new node");
+                constraintViolation(25, "Mandatory child node '" + child + "' not found in a new node");
             }
         }
-        if (!names.isEmpty()) {
-            for (String name : names) {
-                if (NodeStateUtils.isHidden(name)) {
-                    continue;
-                }
+
+        for (String name : names) {
+            if (!NodeStateUtils.isHidden(name)) {
                 NodeState child = after.getChildNode(name);
                 String primary = child.getName(JCR_PRIMARYTYPE);
                 Iterable<String> mixins = child.getNames(JCR_MIXINTYPES);
                 NodeBuilder childBuilder = builder.getChildNode(name);
                 TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, false);
                 if (!effective.isValidChildNode(name, editor.getEffective())) {
-                    constraintViolation(25, "Unexpected child node " + name + " found in a new node");
+                    constraintViolation(25, "Unexpected child node '" + name + "' of effective type '" + editor.getEffective()
+                            + "' found in a new node");
                 }
             }
         }