- fix MojoFailureExceptionDiagnoser so that even under the reactor the long message is shown

- remove long message from BuildFailureException as it was only there for that reason, and caused dual diagnosis

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-14 03:48:39 +00:00
parent ed22c950e8
commit ca0e872a5a
5 changed files with 11 additions and 42 deletions

View File

@ -25,27 +25,13 @@ package org.apache.maven;
public class BuildFailureException
extends Exception
{
private String longMessage;
public BuildFailureException( String message )
{
super( message );
}
public BuildFailureException( String message, String longMessage )
{
super( message );
this.longMessage = longMessage;
}
public BuildFailureException( String message, String longMessage, Throwable cause )
public BuildFailureException( String message, Throwable cause )
{
super( message, cause );
this.longMessage = longMessage;
}
public String getLongMessage()
{
return longMessage;
}
}

View File

@ -659,13 +659,6 @@ public class DefaultMaven
logDiagnostics( e );
if ( e.getLongMessage() != null )
{
getLogger().info( e.getLongMessage() );
line();
}
logTrace( e, showErrors );
if ( !showErrors )

View File

@ -454,7 +454,7 @@ public class DefaultLifecycleExecutor
}
catch ( PluginNotFoundException e )
{
throw new BuildFailureException( "A required plugin was not found", e.getMessage(), e );
throw new BuildFailureException( "A required plugin was not found: " + e.getMessage(), e );
}
}
@ -537,7 +537,7 @@ public class DefaultLifecycleExecutor
}
catch ( MojoFailureException e )
{
throw new BuildFailureException( e.getMessage(), e.getLongMessage(), e );
throw new BuildFailureException( e.getMessage(), e );
}
catch ( MojoExecutionException e )
{

View File

@ -36,39 +36,33 @@ public class MojoExecutionExceptionDiagnoser
StringBuffer message = new StringBuffer();
message.append( "Error executing mojo" );
Object source = mee.getSource();
if ( source != null )
{
message.append( ": " ).append( mee.getSource() ).append( "\n" );
}
else
{
message.append( ".\n" );
}
message.append( "\n" ).append( mee.getMessage() );
message.append( mee.getMessage() );
String longMessage = mee.getLongMessage();
if ( longMessage != null )
{
message.append( "\n\n" ).append( longMessage );
}
Throwable directCause = mee.getCause();
if ( directCause != null )
{
message.append( "\n" );
String directCauseMessage = directCause.getMessage();
if ( directCauseMessage != null && mee.getMessage().indexOf( directCauseMessage ) < 0 )
{
message.append( "\nEmbedded error: " ).append( directCauseMessage );
}
DiagnosisUtils.appendRootCauseIfPresentAndUnique( directCause, message, false );
}

View File

@ -26,7 +26,7 @@ public class MojoFailureExceptionDiagnoser
public boolean canDiagnose( Throwable error )
{
return DiagnosisUtils.containsInCausality( error, MojoFailureExceptionDiagnoser.class );
return DiagnosisUtils.containsInCausality( error, MojoFailureException.class );
}
public String diagnose( Throwable error )
@ -41,12 +41,8 @@ public class MojoFailureExceptionDiagnoser
{
message.append( ": " ).append( mfe.getSource() ).append( "\n" );
}
else
{
message.append( ".\n" );
}
message.append( "\n" ).append( mfe.getMessage() );
message.append( mfe.getMessage() );
String longMessage = mfe.getLongMessage();
if ( longMessage != null )