protected Element findAndReplaceSimpleElement()

in src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java [150:165]


    protected Element findAndReplaceSimpleElement(
            Counter counter, Element parent, String name, String text, String defaultValue) {
        if (defaultValue != null && text != null && defaultValue.equals(text)) {
            Element element = parent.getChild(name, parent.getNamespace());
            // if exist and is default value or if doesn't exist.. just keep the way it is..
            if (element == null || defaultValue.equals(element.getText())) {
                return element;
            }
        }
        boolean shouldExist = text != null && text.trim().length() > 0;
        Element element = updateElement(counter, parent, name, shouldExist);
        if (shouldExist) {
            element.setText(text);
        }
        return element;
    }