o Improved problem reporting

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@884840 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-11-27 11:52:03 +00:00
parent f957961cb8
commit d6e0a1b149
1 changed files with 22 additions and 3 deletions

View File

@ -124,7 +124,7 @@ public class DefaultExceptionHandler
for ( ModelProblem problem : result.getProblems() )
{
ExceptionSummary child = handle( problem );
ExceptionSummary child = handle( problem, result.getProjectId() );
if ( child != null )
{
children.add( child );
@ -143,11 +143,30 @@ public class DefaultExceptionHandler
return new ExceptionSummary( null, message, null, children );
}
private ExceptionSummary handle( ModelProblem problem )
private ExceptionSummary handle( ModelProblem problem, String projectId )
{
if ( ModelProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 )
{
return handle( problem.getMessage(), problem.getException() );
String message = problem.getMessage();
String location = "";
if ( !problem.getModelId().equals( projectId ) )
{
location += problem.getModelId();
if ( StringUtils.isNotEmpty( problem.getSource() ) )
{
location += " (" + problem.getSource() + ")";
}
}
if ( StringUtils.isNotEmpty( location ) )
{
message += " @ " + location;
}
return handle( message, problem.getException() );
}
else
{