mirror of https://github.com/apache/maven.git
[MNG-5456] Incorrect exception handling in parallel build
This commit is contained in:
parent
eb164f514c
commit
973673721b
|
@ -171,17 +171,17 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( OutOfMemoryError e )
|
||||
{
|
||||
result = processResult( new DefaultMavenExecutionResult(), e );
|
||||
result = addExceptionToResult(new DefaultMavenExecutionResult(), e);
|
||||
}
|
||||
catch ( MavenExecutionRequestPopulationException e )
|
||||
{
|
||||
result = processResult( new DefaultMavenExecutionResult(), e );
|
||||
result = addExceptionToResult(new DefaultMavenExecutionResult(), e);
|
||||
}
|
||||
catch ( RuntimeException e )
|
||||
{
|
||||
result =
|
||||
processResult( new DefaultMavenExecutionResult(),
|
||||
new InternalErrorException( "Internal error: " + e, e ) );
|
||||
addExceptionToResult(new DefaultMavenExecutionResult(),
|
||||
new InternalErrorException("Internal error: " + e, e));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( LocalRepositoryNotAccessibleException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
|
||||
DelegatingLocalArtifactRepository delegatingLocalArtifactRepository =
|
||||
|
@ -233,7 +233,7 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( MavenExecutionException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
|
||||
eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null );
|
||||
|
@ -249,7 +249,7 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
|
||||
session.setProjects( projects );
|
||||
|
@ -275,7 +275,7 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( org.apache.maven.DuplicateProjectException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
|
||||
repoSession.setReadOnly();
|
||||
|
@ -292,7 +292,7 @@ public class DefaultMaven
|
|||
}
|
||||
catch ( MavenExecutionException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -315,15 +315,15 @@ public class DefaultMaven
|
|||
|
||||
ProjectCycleException error = new ProjectCycleException( message, e );
|
||||
|
||||
return processResult( result, error );
|
||||
return addExceptionToResult(result, error);
|
||||
}
|
||||
catch ( DuplicateProjectException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
catch ( MavenExecutionException e )
|
||||
{
|
||||
return processResult( result, e );
|
||||
return addExceptionToResult(result, e);
|
||||
}
|
||||
|
||||
result.setTopologicallySortedProjects( session.getProjects() );
|
||||
|
@ -339,7 +339,7 @@ public class DefaultMaven
|
|||
|
||||
if ( session.getResult().hasExceptions() )
|
||||
{
|
||||
return processResult( result, session.getResult().getExceptions().get( 0 ) );
|
||||
return addExceptionToResult(result, session.getResult().getExceptions().get(0));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -592,7 +592,7 @@ public class DefaultMaven
|
|||
return lifecycleListeners;
|
||||
}
|
||||
|
||||
private MavenExecutionResult processResult( MavenExecutionResult result, Throwable e )
|
||||
private MavenExecutionResult addExceptionToResult(MavenExecutionResult result, Throwable e)
|
||||
{
|
||||
if ( !result.getExceptions().contains( e ) )
|
||||
{
|
||||
|
|
|
@ -78,7 +78,8 @@ public class LifecycleThreadedBuilder
|
|||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
break; // Why are we just ignoring this exception? Are exceptions are being used for flow control
|
||||
session.getResult().addException(e);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,10 +126,12 @@ public class LifecycleThreadedBuilder
|
|||
}
|
||||
catch ( InterruptedException e )
|
||||
{
|
||||
rootSession.getResult().addException(e);
|
||||
break;
|
||||
}
|
||||
catch ( ExecutionException e )
|
||||
{
|
||||
rootSession.getResult().addException(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue