private static Node addChildNode()

in src/main/java/org/apache/sling/jcr/repoinit/impl/NodeVisitor.java [187:201]


    private static Node addChildNode(@NotNull Node parent, @NotNull PathSegmentDefinition psd)
            throws RepositoryException {
        String primaryType = psd.getPrimaryType();
        if (primaryType == null) {
            try {
                return parent.addNode(psd.getSegment());
            } catch (ConstraintViolationException e) {
                // assume that no default primary type could be detected -> retry with a default
                slog.info("Adding Node without node type failed ('{}'), retry with sling:Folder", e.getMessage());
                return parent.addNode(psd.getSegment(), "sling:Folder");
            }
        } else {
            return parent.addNode(psd.getSegment(), psd.getPrimaryType());
        }
    }