You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/03/09 20:28:31 UTC

[maven-surefire] branch SUREFIRE-2001 created (now 8897362)

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a change to branch SUREFIRE-2001
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.


      at 8897362  [SUREFIRE-2001] Sometimes the plugin prints an internal stack trace on BUILD FAILURE

This branch includes the following new commits:

     new 8897362  [SUREFIRE-2001] Sometimes the plugin prints an internal stack trace on BUILD FAILURE

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-surefire] 01/01: [SUREFIRE-2001] Sometimes the plugin prints an internal stack trace on BUILD FAILURE

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-2001
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 8897362f641091b8990db6b7bc6bd29064979897
Author: tibordigana <ti...@apache.org>
AuthorDate: Wed Mar 9 21:28:12 2022 +0100

    [SUREFIRE-2001] Sometimes the plugin prints an internal stack trace on BUILD FAILURE
---
 .../java/org/apache/maven/plugin/surefire/SurefireHelper.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
index 1870223..b64f436 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
@@ -265,15 +265,18 @@ public final class SurefireHelper
                                            Exception firstForkException )
             throws MojoFailureException, MojoExecutionException
     {
+        String msg = createErrorMessage( reportParameters, result, firstForkException );
         if ( isFatal( firstForkException ) || result.isInternalError()  )
         {
-            throw new MojoExecutionException( createErrorMessage( reportParameters, result, firstForkException ),
-                                                    firstForkException );
+            throw firstForkException == null
+                ? new MojoExecutionException( msg )
+                : new MojoExecutionException( msg, firstForkException );
         }
         else
         {
-            throw new MojoFailureException( createErrorMessage( reportParameters, result, firstForkException ),
-                                                  firstForkException );
+            throw firstForkException == null
+                ? new MojoFailureException( msg )
+                : new MojoFailureException( msg, firstForkException );
         }
     }