CPD Results

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

Duplications

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

            Xpp3DomWriter.write( writer, dom );

            writer.close();
            writer = null;
        }
        finally
        {
            IOUtil.close( writer );
        }

        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 1619
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1886
        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
     */
    //CHECKSTYLE_OFF: LineLength
    protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element )
File Line
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1619
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1646
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1886
        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/plugins/shade/pom/MavenJDOMWriter.java 1213
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1240
            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" );
        }
    } // -- void updateBuild(Build, String, Counter, Element)
    //CHECKSTYLE_ON: LineLength

    /**
     * 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/plugins/shade/pom/MavenJDOMWriter.java 1305
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1398
        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/plugins/shade/pom/MavenJDOMWriter.java 305
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 357
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 409
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 461
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 513
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 565
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 617
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 669
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 721
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 773
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 825
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 877
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 929
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 981
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1033
    protected void iterateContributor( Counter counter, Element parent, Collection<Contributor> list,
                                       java.lang.String parentTag, java.lang.String childTag )
    {
        boolean shouldExist = list != null && list.size() > 0;
        Element element = updateElement( counter, parent, parentTag, shouldExist );
        if ( shouldExist )
        {
            Iterator<?> elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
            if ( !elIt.hasNext() )
            {
                elIt = null;
            }
            Counter innerCount = new Counter( counter.getDepth() + 1 );
            for ( Contributor value : list )