CPD Results

The following document contains the results of PMD's CPD 6.49.0.

Duplications

File Line
org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java 148
org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java 146
componentDom.addChild(component);
            }

            Xpp3DomWriter.write(writer, dom);
        }

        return baos.toByteArray();
    }

    private String getRelocatedClass(String className, List<Relocator> relocators) {
        if (className != null && className.length() > 0 && relocators != null) {
            for (Relocator relocator : relocators) {
                if (relocator.canRelocateClass(className)) {
                    return relocator.relocateClass(className);
                }
            }
        }

        return className;
    }

    private static String getValue(Xpp3Dom dom, String element) {
        Xpp3Dom child = dom.getChild(element);

        return (child != null && child.getValue() != null) ? child.getValue() : "";
    }

    private static void setValue(Xpp3Dom dom, String element, String value) {
        Xpp3Dom child = dom.getChild(element);

        if (child == null || value == null || value.length() <= 0) {
            return;
        }

        child.setValue(value);
    }
File Line
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1035
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1060
iterateExtension(innerCount, root, value.getExtensions(), "extensions", "extension");
            findAndReplaceSimpleElement(innerCount, root, "defaultGoal", value.getDefaultGoal(), null);
            iterateResource(innerCount, root, value.getResources(), "resources", "resource");
            iterateResource(innerCount, root, value.getTestResources(), "testResources", "testResource");
            findAndReplaceSimpleElement(innerCount, root, "directory", value.getDirectory(), null);
            findAndReplaceSimpleElement(innerCount, root, "finalName", value.getFinalName(), null);
            findAndReplaceSimpleLists(innerCount, root, value.getFilters(), "filters", "filter");
            updatePluginManagement(value.getPluginManagement(), "pluginManagement", innerCount, root);
            iteratePlugin(innerCount, root, value.getPlugins(), "plugins", "plugin");
        }
    }
    // CHECKSTYLE_ON: LineLength

    /**
     * Method updateBuildBase
     *
     * @param value The value.
     * @param element {@link Element}
     * @param counter {@link Counter}
     * @param xmlTag The XMLTag.
     */
    protected void updateBuildBase(BuildBase value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1120
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1210
Counter innerCount = new Counter(counter.getDepth() + 1);
        findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
        findAndReplaceSimpleElement(innerCount, root, "email", value.getEmail(), null);
        findAndReplaceSimpleElement(innerCount, root, "url", value.getUrl(), null);
        findAndReplaceSimpleElement(innerCount, root, "organization", value.getOrganization(), null);
        findAndReplaceSimpleElement(innerCount, root, "organizationUrl", value.getOrganizationUrl(), null);
        findAndReplaceSimpleLists(innerCount, root, value.getRoles(), "roles", "role");
        findAndReplaceSimpleElement(innerCount, root, "timezone", value.getTimezone(), null);
        findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
    }

    /**
     * Method updateDependency
     *
     * @param value The value.
     * @param element {@link Element}
     * @param counter {@link Counter}
     * @param xmlTag The XMLTag.
     */
    protected void updateDependency(Dependency value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1414
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1679
iterateProfile(innerCount, root, value.getProfiles(), "profiles", "profile");
        findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
        iterateRepository(innerCount, root, value.getRepositories(), "repositories", "repository");
        iterateRepository(innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository");
        iterateDependency(innerCount, root, value.getDependencies(), "dependencies", "dependency");
        updateReporting(value.getReporting(), "reporting", innerCount, root);
        updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
        updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
        findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
    }

    /**
     * Method updateModelBase
     *
     * @param value The value.
     * @param element {@link Element}
     * @param counter {@link Counter}
     * @param xmlTag The XMLTag.
     */
    // CHECKSTYLE_OFF: LineLength
    protected void updateModelBase(ModelBase value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1414
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1438
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1679
iterateProfile(innerCount, root, value.getProfiles(), "profiles", "profile");
        findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
        iterateRepository(innerCount, root, value.getRepositories(), "repositories", "repository");
        iterateRepository(innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository");
        iterateDependency(innerCount, root, value.getDependencies(), "dependencies", "dependency");
        updateReporting(value.getReporting(), "reporting", innerCount, root);
        updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
        updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
        findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
    }