Commit 83fbdc6e authored by artsiom's avatar artsiom Committed by Andy Wilkinson

Fix NPE in FlywayEndpoint when migration.installedOn is null

See gh-14019
parent 26af0ca7
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment