Fork me on GitHub

CPD Results

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

Duplications

File Line
org\apache\maven\surefire\util\NestedCheckedException.java 99
org\apache\maven\surefire\util\NestedRuntimeException.java 100
        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 );
        }
    }
}