Skip to content

Commit

Permalink
[MNG-5729] Fix possible NPE with introduction of mononic clock
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Dec 13, 2024
1 parent 50aecc7 commit 15531fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
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;

Expand Down Expand Up @@ -278,7 +280,8 @@ private void logStats(MavenSession session) {

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ protected void stop() {
}

protected Duration wallTime() {
return Duration.between(start, end);
return start != null && end != null ? Duration.between(start, end) : Duration.ZERO;
}

protected Duration execTime() {
Expand Down

0 comments on commit 15531fb

Please sign in to comment.