Skip to content

NullPointerException in FlywayEndpoint with schema baseline #14009

@gbehrmann

Description

@gbehrmann

Spring Boot 2.0.4

In case a Flyway managed schema has a baseline, migrations prior to the baseline are not considered as applied by Flyway. As a result org.flyway.core.api.MigrationInfo#getInstalledOn returns null. This triggers a NullPointerException in the org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayMigration constructor when the installation time is to be converted to an Instant:

		private FlywayMigration(MigrationInfo info) {
			this.type = info.getType();
			this.checksum = info.getChecksum();
			this.version = nullSafeToString(info.getVersion());
			this.description = info.getDescription();
			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();
		}
Stack Trace
Caused by: java.lang.NullPointerException: null
        at org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayMigration.(FlywayEndpoint.java:167)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayMigration.(FlywayEndpoint.java:137)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayDescriptor.lambda$new$0(FlywayEndpoint.java:120)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayDescriptor.(FlywayEndpoint.java:121)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint$FlywayDescriptor.(FlywayEndpoint.java:115)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint.lambda$flywayBeans$0(FlywayEndpoint.java:59)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at org.springframework.boot.actuate.flyway.FlywayEndpoint.flywayBeans(FlywayEndpoint.java:58)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223)
        at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76)
        at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61)
        at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:243)
        at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:299)
        at jdk.internal.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
        ... 92 common frames omitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions