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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new ccbd50c975 [MNG-5729] Fix possible NPE with introduction of mononic 
clock (#1972)
ccbd50c975 is described below

commit ccbd50c9754f0c7b4d63fedd39d06ffc1cb70c2a
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Fri Dec 13 16:40:45 2024 +0100

    [MNG-5729] Fix possible NPE with introduction of mononic clock (#1972)
---
 .../main/java/org/apache/maven/cling/event/ExecutionEventLogger.java | 5 ++++-
 .../maven/lifecycle/internal/concurrent/BuildPlanExecutor.java       | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/event/ExecutionEventLogger.java
 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/event/ExecutionEventLogger.java
index 791f81a15e..3d506a6050 100644
--- 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/event/ExecutionEventLogger.java
+++ 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/event/ExecutionEventLogger.java
@@ -23,6 +23,8 @@ import java.nio.file.Path;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.List;
 import java.util.Objects;
 
@@ -278,7 +280,8 @@ public class ExecutionEventLogger extends 
AbstractExecutionListener {
 
         logger.info("Total time:  {}{}", formatDuration(time), wallClock);
 
-        logger.info("Finished at: {}", 
formatTimestamp(finish.atZone(ZoneId.systemDefault())));
+        ZonedDateTime rounded = 
finish.truncatedTo(ChronoUnit.SECONDS).atZone(ZoneId.systemDefault());
+        logger.info("Finished at: {}", formatTimestamp(rounded));
     }
 
     @Override
diff --git 
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
 
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
index ccc16724a1..57fdc9dabb 100644
--- 
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
+++ 
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
@@ -927,7 +927,7 @@ public class BuildPlanExecutor {
         }
 
         protected Duration wallTime() {
-            return Duration.between(start, end);
+            return start != null && end != null ? Duration.between(start, end) 
: Duration.ZERO;
         }
 
         protected Duration execTime() {

Reply via email to