Fork me on GitHub

CPD Results

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

Duplications

FileLine
org\apache\maven\surefire\util\internal\StringUtils.java430
org\apache\maven\surefire\util\internal\StringUtils.java524
    public static void escapeJavaStyleString( ByteBuffer out, byte[] str, int off, int len )
    {
        if ( out == null )
        {
            throw new IllegalArgumentException( "The Writer must not be null" );
        }
        final int inputLength = str.length;
        if ( str == null || inputLength == 0 )
        {
            return;
        }
        int outputPos = 0;
        int end = off + len;
        for ( int i = off; i < end; i++ )
        {
            char ch = (char) str[i];

            // handle unicode
            if ( ch > 0xfff )
            {
                outputPos = writeOut( out, outputPos, "\\u" + hex( ch ) );
            }
            else if ( ch > 0xff )
            {
                outputPos = writeOut( out, outputPos, "\\u0" + hex( ch ) );
            }
            else if ( ch > 0x7f || ch == ',' )
            {    // Kr - this line modified from commons
                outputPos = writeOut( out, outputPos, "\\u00" + hex( ch ) );
            }
            else if ( ch < 32 )
            {
                switch ( ch )
                {
                    case '\b':
                        out.append( '\\' );
                        out.append( 'b' );
                        break;
                    case '\n':
                        out.append( '\\' );
                        out.append( 'n' );
                        break;
                    case '\t':
                        out.append( '\\' );
                        out.append( 't' );
                        break;
                    case '\f':
                        out.append( '\\' );
                        out.append( 'f' );
                        break;
                    case '\r':
                        out.append( '\\' );
                        out.append( 'r' );
                        break;
                    default:
                        if ( ch > 0xf )
                        {
                            outputPos = writeOut( out, outputPos, "\\u00" + hex( ch ) );
                        }
                        else
                        {
                            outputPos = writeOut( out, outputPos, "\\u000" + hex( ch ) );
                        }
                        break;
                }
            }
            else
            {
                switch ( ch )
                {
                    case '\'':
                        out.append( '\\' );
                        out.append( '\'' );
                        break;
                    case '"':
                        out.append( '\\' );
                        out.append( '"' );
                        break;
                    case '\\':
                        out.append( '\\' );
                        out.append( '\\' );
                        break;
                    case '/':
                        out.append( '\\' );
                        out.append( '/' );
                        break;
                    default:
                        out.append( ch );
                        break;
                }
            }
        }
    }

    public static void escapeJavaStyleString( PrintStream out, byte[] str, int off, int len )
FileLine
org\apache\maven\surefire\util\NestedCheckedException.java99
org\apache\maven\surefire\util\NestedRuntimeException.java100
        super( msg );
        this.cause = ex;
    }

    /**
     * Return the nested cause, or <code>null</code> if none.
     */
    public Throwable getCause()
    {
        // Even if you cannot set the cause of this exception other than through
        // the constructor, we check for the cause being "this" here, as the cause
        // could still be set to "this" via reflection: for example, by a remoting
        // deserializer like Hessian's.
        return ( this.cause == this ? null : this.cause );
    }

    /**
     * Return the detail message, including the message from the nested exception
     * if there is one.
     */
    public String getMessage()
    {
        if ( getCause() == null )
        {
            return super.getMessage();
        }
        else
        {
            return super.getMessage() + "; nested exception is " + getCause().getClass().getName() + ": "
                + getCause().getMessage();
        }
    }

    /**
     * Print the composite message and the embedded stack trace to the specified stream.
     *
     * @param ps the print stream
     */
    public void printStackTrace( PrintStream ps )
    {
        if ( getCause() == null )
        {
            super.printStackTrace( ps );
        }
        else
        {
            ps.println( this );
            getCause().printStackTrace( ps );
        }
    }

    /**
     * Print the composite message and the embedded stack trace to the specified print writer.
     *
     * @param pw the print writer
     */
    public void printStackTrace( PrintWriter pw )
    {
        if ( getCause() == null )
        {
            super.printStackTrace( pw );
        }
        else
        {
            pw.println( this );
            getCause().printStackTrace( pw );
        }
    }
}
FileLine
org\apache\maven\surefire\util\internal\StringUtils.java442
org\apache\maven\surefire\util\internal\StringUtils.java536
org\apache\maven\surefire\util\internal\StringUtils.java630
        int end = off + len;
        for ( int i = off; i < end; i++ )
        {
            char ch = (char) str[i];

            // handle unicode
            if ( ch > 0xfff )
            {
                outputPos = writeOut( out, outputPos, "\\u" + hex( ch ) );
            }
            else if ( ch > 0xff )
            {
                outputPos = writeOut( out, outputPos, "\\u0" + hex( ch ) );
            }
            else if ( ch > 0x7f || ch == ',' )
            {    // Kr - this line modified from commons
                outputPos = writeOut( out, outputPos, "\\u00" + hex( ch ) );
            }
            else if ( ch < 32 )
            {
                switch ( ch )
                {
                    case '\b':
                        out.append( '\\' );