From b4229239ab2ef4fe175aabb5e51f57d688084914 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 22 Jan 2020 12:14:25 -0800 Subject: [PATCH] Protect against NPE in server tests Update `AbstractApplicationLauncher` to not attempt to shutdown the process if startup fails. --- .../boot/context/embedded/AbstractApplicationLauncher.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java index c6ee9366ee..90b3cf4115 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java @@ -57,7 +57,9 @@ abstract class AbstractApplicationLauncher implements BeforeEachCallback, AfterE @Override public void afterEach(ExtensionContext context) throws Exception { - this.process.destroy(); + if (this.process != null) { + this.process.destroy(); + } } @Override