From 09373622ca9323d1d35756f4ba542798237c9aac Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 28 May 2019 16:15:26 -0700 Subject: [PATCH] Polish "Allow Tomcat be destroyed regardless of exceptions" See gh-16892 --- .../boot/web/embedded/tomcat/TomcatWebServer.java | 2 +- .../web/embedded/tomcat/TomcatServletWebServerFactoryTests.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java index 2540914077..d9d699235b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index 2c427d4eaa..f33704a1b3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -526,6 +526,7 @@ public class TomcatServletWebServerFactoryTests @Test public void exceptionThrownOnContextListenerDestroysServer() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0) { + @Override protected TomcatWebServer getTomcatWebServer(Tomcat tomcat) { try { @@ -536,6 +537,7 @@ public class TomcatServletWebServerFactoryTests .isEqualTo(LifecycleState.DESTROYED); } } + }; assertThatExceptionOfType(WebServerException.class) .isThrownBy(() -> factory.getWebServer((context) -> context