Fix NPE in FlywayEndpoint when migration.installedOn is null

See gh-14019
pull/14032/head
artsiom 6 years ago committed by Andy Wilkinson
parent 26af0ca742
commit 83fbdc6ea8

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

Loading…
Cancel
Save