CPD Results

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

Duplications

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

            Xpp3DomWriter.write( writer, dom );
        }
        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 1692
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1958
        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/plugins/shade/pom/MavenJDOMWriter.java 1692
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1718
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1958
        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 1287
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1313
            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)

    /**
     * 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 1378
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1471
        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 317
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 371
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 425
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 479
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 533
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 587
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 641
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 695
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 749
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 803
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 857
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 911
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 965
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1019
org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java 1073
    protected void iterateContributor( Counter counter, Element parent, java.util.Collection 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 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() )
            {