Fork me on GitHub

CPD Results

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

Duplications

File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 1568
org/apache/maven/archetype/common/MavenJDOMWriter.java 1830
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");
        findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom) value.getReports());
        updateReporting(value.getReporting(), "reporting", innerCount, root);
        updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
        updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
        findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
    } // -- void updateModel(Model, String, Counter, Element)

    /**
     * Method updateModelBase.
     *
     * @param value
     * @param element
     * @param counter
     * @param xmlTag
     */
    protected void updateModelBase(ModelBase value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 1568
org/apache/maven/archetype/common/MavenJDOMWriter.java 1592
org/apache/maven/archetype/common/MavenJDOMWriter.java 1830
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");
        findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom) value.getReports());
        updateReporting(value.getReporting(), "reporting", innerCount, root);
        updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
        updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
        findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
    } // -- void updateModel(Model, String, Counter, Element)
File Line
org/apache/maven/archetype/creator/FilesetArchetypeCreator.java 834
org/apache/maven/archetype/creator/FilesetArchetypeCreator.java 1059
Model pom,
            File archetypeFilesDirectory,
            Properties pomReversedProperties,
            File initialPomFile,
            boolean preserveCData,
            boolean keepParent)
            throws IOException {
        File outputFile = FileUtils.resolveFile(archetypeFilesDirectory, Constants.ARCHETYPE_POM);

        if (preserveCData) {
            getLogger().debug("Preserving CDATA parts of pom");
            File inputFile = FileUtils.resolveFile(archetypeFilesDirectory, Constants.ARCHETYPE_POM + ".tmp");

            FileUtils.copyFile(initialPomFile, inputFile);

            outputFile.getParentFile().mkdirs();

            try (Reader in = new XmlStreamReader(inputFile);
                    Writer out = new XmlStreamWriter(outputFile)) {
                String initialcontent = IOUtil.toString(in);

                String content = getReversedContent(initialcontent, pomReversedProperties);

                IOUtil.copy(content, out);
            }

            inputFile.delete();
        } else {
            if (!keepParent) {
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 1187
org/apache/maven/archetype/common/MavenJDOMWriter.java 1211
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");
        } // end if
    } // -- void updateBuild(Build, String, Counter, Element)

    /**
     * Method updateBuildBase.
     *
     * @param value
     * @param element
     * @param counter
     * @param xmlTag
     */
    protected void updateBuildBase(BuildBase value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 1271
org/apache/maven/archetype/common/MavenJDOMWriter.java 1365
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());
    } // -- void updateContributor(Contributor, String, Counter, Element)

    /**
     * Method updateDependency.
     *
     * @param value
     * @param element
     * @param counter
     * @param xmlTag
     */
    protected void updateDependency(Dependency value, String xmlTag, Counter counter, Element element) {
File Line
org/apache/maven/archetype/common/util/XMLOutputter.java 1332
org/apache/maven/archetype/common/util/XMLOutputter.java 1403
break;
                default:
                    if (strategy.shouldEscape(ch)) {
                        entity = "&#x" + Integer.toHexString(ch) + ";";
                    } else {
                        entity = null;
                    }
                    break;
            }
            if (buffer == null) {
                if (entity != null) {
                    // An entity occurred, so we'll have to use StringBuilder
                    // (allocate room for it plus a few more entities).
                    buffer = new StringBuilder(str.length() + 20);
                    // Copy previous skipped characters and fall through
                    // to pickup current character
                    buffer.append(str.substring(0, i));
                    buffer.append(entity);
                }
            } else {
                if (entity == null) {
                    buffer.append(ch);
                } else {
                    buffer.append(entity);
                }
            }
        }

        // If there were any entities, return the escaped characters
        // that we put in the StringBuilder. Otherwise, just return
        // the unmodified input string.
        return (buffer == null) ? str : buffer.toString();
    }
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 624
org/apache/maven/archetype/common/MavenJDOMWriter.java 671
org/apache/maven/archetype/common/MavenJDOMWriter.java 718
org/apache/maven/archetype/common/MavenJDOMWriter.java 765
org/apache/maven/archetype/common/MavenJDOMWriter.java 812
org/apache/maven/archetype/common/MavenJDOMWriter.java 859
org/apache/maven/archetype/common/MavenJDOMWriter.java 906
org/apache/maven/archetype/common/MavenJDOMWriter.java 953
org/apache/maven/archetype/common/MavenJDOMWriter.java 1000
protected void iterateMailingList(
            Counter counter, Element parent, java.util.Collection list, String parentTag, String childTag) {
        boolean shouldExist = (list != null) && (list.size() > 0);
        Element element = updateElement(counter, parent, parentTag, shouldExist);
        if (shouldExist) {
            Iterator it = list.iterator();
            Iterator elIt =
                    element.getChildren(childTag, element.getNamespace()).iterator();
            if (!elIt.hasNext()) {
                elIt = null;
            }

            Counter innerCount = new Counter(counter.getDepth() + 1);
            while (it.hasNext()) {
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 345
org/apache/maven/archetype/common/MavenJDOMWriter.java 392
org/apache/maven/archetype/common/MavenJDOMWriter.java 439
org/apache/maven/archetype/common/MavenJDOMWriter.java 486
org/apache/maven/archetype/common/MavenJDOMWriter.java 532
org/apache/maven/archetype/common/MavenJDOMWriter.java 578
protected void iterateContributor(
            Counter counter, Element parent, Collection list, String parentTag, String childTag) {
        boolean shouldExist = (list != null) && (list.size() > 0);
        Element element = updateElement(counter, parent, parentTag, shouldExist);
        if (shouldExist) {
            Iterator it = list.iterator();
            Iterator elIt =
                    element.getChildren(childTag, element.getNamespace()).iterator();
            if (!elIt.hasNext()) {
                elIt = null;
            }

            Counter innerCount = new Counter(counter.getDepth() + 1);
            while (it.hasNext()) {
File Line
org/apache/maven/archetype/common/MavenJDOMWriter.java 346
org/apache/maven/archetype/common/MavenJDOMWriter.java 393
org/apache/maven/archetype/common/MavenJDOMWriter.java 440
org/apache/maven/archetype/common/MavenJDOMWriter.java 487
org/apache/maven/archetype/common/MavenJDOMWriter.java 533
org/apache/maven/archetype/common/MavenJDOMWriter.java 578
org/apache/maven/archetype/common/MavenJDOMWriter.java 625
org/apache/maven/archetype/common/MavenJDOMWriter.java 672
org/apache/maven/archetype/common/MavenJDOMWriter.java 719
org/apache/maven/archetype/common/MavenJDOMWriter.java 766
org/apache/maven/archetype/common/MavenJDOMWriter.java 813
org/apache/maven/archetype/common/MavenJDOMWriter.java 860
org/apache/maven/archetype/common/MavenJDOMWriter.java 907
org/apache/maven/archetype/common/MavenJDOMWriter.java 954
org/apache/maven/archetype/common/MavenJDOMWriter.java 1001
Counter counter, Element parent, Collection list, String parentTag, String childTag) {
        boolean shouldExist = (list != null) && (list.size() > 0);
        Element element = updateElement(counter, parent, parentTag, shouldExist);
        if (shouldExist) {
            Iterator it = list.iterator();
            Iterator elIt =
                    element.getChildren(childTag, element.getNamespace()).iterator();
            if (!elIt.hasNext()) {
                elIt = null;
            }

            Counter innerCount = new Counter(counter.getDepth() + 1);
            while (it.hasNext()) {