private ILicense parseLicense()

in apache-rat-core/src/main/java/org/apache/rat/configuration/XMLConfigurationReader.java [468:502]


    private ILicense parseLicense(final Node licenseNode) {
        try {
            ILicense.Builder builder = ILicense.builder();
            // get the description for the builder
            Description description = builder.getDescription();
            // set the BUILDER_PARAM options from the description
            processBuilderParams(description, builder);
            // set the children from attributes.
            description.setChildren(builder, attributes(licenseNode));
            // set children from the child nodes
            Pair<Boolean, List<Node>> pair = processChildNodes(description, licenseNode,
                    licenseChildNodeProcessor(builder, description));
            List<Node> children = pair.getRight();

            // check for inline nodes that can accept child nodes.
            List<Description> childDescriptions = description.getChildren().values().stream()
                    .filter(d -> XMLConfig.isLicenseInline(d.getCommonName())).collect(Collectors.toList());
            for (Description childDescription : childDescriptions) {
                Iterator<Node> iter = children.iterator();
                while (iter.hasNext()) {
                    callSetter(childDescription, builder, parseMatcher(iter.next()));
                    iter.remove();
                }
            }

            if (!children.isEmpty()) {
                children.forEach(n -> DefaultLog.getInstance().warn(String.format("unrecognised child node '%s' in node '%s'%n",
                        n.getNodeName(), licenseNode.getNodeName())));
            }
            return builder.build();
        } catch (RuntimeException exception) {
            DefaultLog.getInstance().error(String.format("License error in: '%s'", nodeText(licenseNode)));
            throw exception;
        }
    }