Julian Reschke created JCR-3606:
-----------------------------------

             Summary: misleading expepction message in 
ItemSaveOperation.validateTransientItems()
                 Key: JCR-3606
                 URL: https://issues.apache.org/jira/browse/JCR-3606
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
          Components: jackrabbit-core
    Affects Versions: 2.7, 2.6.1, 2.4.4
            Reporter: Julian Reschke
            Priority: Minor


When checking for mandatory child nodes, the code also checks whether that 
child node is the expected defining node type. If it does not, the same message 
as for a *missing* child node is generated:

                    String msg = itemMgr.safeGetJCRPath(id)
                                + ": mandatory child node " + cnd.getName()
                                + " does not exist";
                    if (!nodeState.hasChildNodeEntry(cnd.getName())) {
                        log.debug(msg);
                        throw new ConstraintViolationException(msg);
                    } else {
                        /*
                        there exists a child node with the mandatory-name.
                        make sure the node really has the expected mandatory
                        node definition.
                        */
                        boolean hasMandatoryChild = false;
                        for (ChildNodeEntry cne : 
nodeState.getChildNodeEntries(cnd.getName())) {
                            ItemData childData = 
itemMgr.getItemData(cne.getId(), null, false);
                            if (childData.getDefinition().isMandatory()) {
                                hasMandatoryChild = true;
                                break;
                            }
                        }
                        if (!hasMandatoryChild) {
                            throw new ConstraintViolationException(msg);
                        }
                    }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to