From 2e540780832143d9ceaf884da5846115baafed7b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 18 Apr 2016 15:30:23 +0100 Subject: [PATCH] Tolerate possible null Flyway MigrationVersion when using Flyway 4.0 Flyway 4.0 provides support for repeatable migrations that do not have a version. When such a migration has been performed, MigrationInfo.getMigrationVersion() will return null and, previously, FlywayEndpoint would fail with an NPE. This commit updates FlywayEndpoint to use null as the version when MigrationInfo.getMigrationVersion() returns null. Closes gh-5700 --- .../springframework/boot/actuate/endpoint/FlywayEndpoint.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java index 3befb1154d..1dd091cded 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java @@ -34,6 +34,7 @@ import org.springframework.util.Assert; * * @author EddĂș MelĂ©ndez * @author Phillip Webb + * @author Andy Wilkinson * @since 1.3.0 */ @ConfigurationProperties(prefix = "endpoints.flyway") @@ -80,7 +81,8 @@ public class FlywayEndpoint extends AbstractEndpoint> { public FlywayMigration(MigrationInfo info) { this.type = info.getType(); this.checksum = info.getChecksum(); - this.version = info.getVersion().toString(); + this.version = info.getVersion() != null ? info.getVersion().toString() + : null; this.description = info.getDescription(); this.script = info.getScript(); this.state = info.getState();