TypeEditor: constraint exception for invalid child node should contain that node's effective type
@@ -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;
- }
+ 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");
}
}
}
