You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/05/24 20:41:20 UTC

[maven-surefire] branch SUREFIRE-2169 created (now 56ebd61d8)

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

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


      at 56ebd61d8 [SUREFIRE-2169] Potential NPE in WrappedReportEntry when #getElapsed() is called

This branch includes the following new commits:

     new 56ebd61d8 [SUREFIRE-2169] Potential NPE in WrappedReportEntry when #getElapsed() is called

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-2169] Potential NPE in WrappedReportEntry when #getElapsed() is called

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

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

commit 56ebd61d8af355ad630625ff8044e93ce6d9dfef
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed May 24 22:40:51 2023 +0200

    [SUREFIRE-2169] Potential NPE in WrappedReportEntry when #getElapsed() is called
    
    This closes #643
---
 .../org/apache/maven/plugin/surefire/report/WrappedReportEntry.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index 97b3734c2..b66a1cfea 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -140,7 +140,7 @@ public class WrappedReportEntry implements TestSetReportEntry {
     }
 
     public String elapsedTimeAsString() {
-        return formatElapsedTime(getElapsed());
+        return getElapsed() != null ? formatElapsedTime(getElapsed()) : null;
     }
 
     String getReportSourceName() {
@@ -171,7 +171,7 @@ public class WrappedReportEntry implements TestSetReportEntry {
     }
 
     public String getElapsedTimeVerbose() {
-        return "Time elapsed: " + elapsedTimeAsString() + " s";
+        return "Time elapsed: " + (getElapsed() != null ? elapsedTimeAsString() + " s" : "(unknown)");
     }
 
     public String getElapsedTimeSummary() {