Fork me on GitHub

CPD Results

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

Duplications

File Line
org/codehaus/mojo/clirr/AbstractClirrCheckMojo.java 74
org/codehaus/mojo/clirr/ClirrArbitraryCheckMojo.java 108
            listener = executeClirr( minSeverity );
        }
        catch ( MissingPreviousException e )
        {
            getLog().debug( e );
            getLog().info( "No previous version was found. Use 'comparisonArtifacts'"
                    + " for explicit configuration if you think this is wrong." );
            return;
        }

        Locale locale = Locale.getDefault();

        int errorCount = listener.getSeverityCount( Severity.ERROR );
        if ( failOnError && errorCount > 0 )
        {
            log( listener, Severity.ERROR );
            String message;
            if ( errorCount > 1 )
            {
                String[] args = new String[]{String.valueOf( errorCount )};
                message = i18n.format( "clirr-report", locale, "check.clirr.failure.errors", args );
            }
            else
            {
                message = i18n.getString( "clirr-report", locale, "check.clirr.failure.error" );
            }
            throw new MojoFailureException( message );
        }

        int warningCount = listener.getSeverityCount( Severity.WARNING );
        if ( failOnWarning && warningCount > 0 )
File Line
org/codehaus/mojo/clirr/AbstractClirrMojo.java 278
org/codehaus/mojo/clirr/ClirrArbitraryCheckMojo.java 259
                listeners.add( new TypeRevealingXmlDiffListener( xmlOutputFile.getAbsolutePath() ) );
            }
            catch ( IOException e )
            {
                throw new MojoExecutionException( "Error adding '" + xmlOutputFile + "' for output: " + e.getMessage(),
                                                  e );
            }
        }

        if ( textOutputFile != null )
        {
            try
            {
                listeners.add( new PlainDiffListener( textOutputFile.getAbsolutePath() ) );
            }
            catch ( IOException e )
            {
                throw new MojoExecutionException( "Error adding '" + textOutputFile + "' for output: " + e.getMessage(),
                                                  e );
            }
        }

        if ( logResults )
        {
            listeners.add( new LogDiffListener( getLog() ) );
        }

        checker.addDiffListener( new DelegatingListener( listeners, minSeverity, getAllIgnored() ) );
File Line
org/codehaus/mojo/clirr/Difference.java 836
org/codehaus/mojo/clirr/Difference.java 871
    private boolean matches10000( ApiDifference apiDiff )
    {
        throwIfMissing( false, false, true, true );

        int fromVersion = 0;
        int toVersion = 0;
        try
        {
            fromVersion = Integer.parseInt( from );
        }
        catch ( NumberFormatException e )
        {
            throw new IllegalArgumentException( "Failed to parse the \"from\" parameter as a number for " + this );
        }

        try
        {
            toVersion = Integer.parseInt( to );
        }
        catch ( NumberFormatException e )
        {
            throw new IllegalArgumentException( "Failed to parse the \"to\" parameter as a number for " + this );
        }

        String[] args = getArgs( apiDiff );

        int reportedOld = Integer.parseInt( args[0] );
        int reportedNew = Integer.parseInt( args[1] );

        return fromVersion == reportedOld && toVersion == reportedNew;
    }

    /**
     * Class format version decreased
     */
    private boolean matches10001( ApiDifference apiDiff )