Cleaning up diagnosis output for MojoExecutionException's.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@314785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-10-12 05:05:39 +00:00
parent 60854c5f75
commit 06dc81b54e
1 changed files with 22 additions and 3 deletions

View File

@ -17,16 +17,35 @@ public class MojoExecutionExceptionDiagnoser
StringBuffer message = new StringBuffer(); StringBuffer message = new StringBuffer();
message.append( "Error executing mojo: " ).append( mee.getSource() ).append( "\n\n" ); message.append( "Error executing mojo" );
message.append( mee.getLongMessage() ).append( "\n\n" );
Object source = mee.getSource();
if ( source != null )
{
message.append( ": " ).append( mee.getSource() ).append( "\n" );
}
else
{
message.append( ".\n" );
}
message.append( "\nMessage: " ).append( mee.getMessage() );
String longMessage = mee.getLongMessage();
if ( longMessage != null )
{
message.append( "\n\n" ).append( longMessage );
}
Throwable root = DiagnosisUtils.getRootCause( mee ); Throwable root = DiagnosisUtils.getRootCause( mee );
if ( root != null && root != mee ) if ( root != null && root != mee )
{ {
message.append( "Root Cause: " ).append( root.getMessage() ).append( "\n\n" ); message.append( "\n\nRoot Cause: " ).append( root.getMessage() );
} }
message.append( "\n\n" );
return message.toString(); return message.toString();
} }