diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java index f8a1c4f497..cad08560e7 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.flyway; import java.time.Instant; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,6 +39,7 @@ import org.springframework.context.ApplicationContext; * @author EddĂș MelĂ©ndez * @author Phillip Webb * @author Andy Wilkinson + * @author Artsiom Yudovin * @since 2.0.0 */ @Endpoint(id = "flyway") @@ -164,9 +166,14 @@ public class FlywayEndpoint { this.script = info.getScript(); this.state = info.getState(); this.installedBy = info.getInstalledBy(); - this.installedOn = Instant.ofEpochMilli(info.getInstalledOn().getTime()); this.installedRank = info.getInstalledRank(); this.executionTime = info.getExecutionTime(); + this.installedOn = toEpochMilli(info.getInstalledOn()); + } + + private Instant toEpochMilli(Date installedOn) { + return (installedOn != null) ? Instant.ofEpochMilli(installedOn.getTime()) + : null; } private String nullSafeToString(Object obj) {