[MNG-5729] Fix possible NPE with introduction of mononic clock ()

This commit is contained in:
Guillaume Nodet 2024-12-13 16:40:45 +01:00 committed by GitHub
parent a85ec9ffcc
commit ccbd50c975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions
impl
maven-cli/src/main/java/org/apache/maven/cling/event
maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent

View File

@ -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

View File

@ -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() {