From a13666d69619332ca8c4806f3777794183e7aeae Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 26 Sep 2019 19:12:18 -0700 Subject: [PATCH] Polish "Simplify code" See gh-18342 --- .../boot/gradle/tasks/bundling/BootArchiveSupport.java | 4 ++-- .../embedded/tomcat/TomcatServletWebServerFactoryTests.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java index bf6a818d34..330b314398 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java @@ -143,8 +143,8 @@ class BootArchiveSupport { } private boolean isZip(InputStream inputStream) throws IOException { - for (byte b : ZIP_FILE_HEADER) { - if (inputStream.read() != b) { + for (byte headerByte : ZIP_FILE_HEADER) { + if (inputStream.read() != headerByte) { return false; } } 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 2c138b96de..b8758a395a 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 @@ -68,7 +68,6 @@ import org.mockito.InOrder; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.web.server.PortInUseException; import org.springframework.boot.web.server.WebServerException; -import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests; import org.springframework.core.io.ByteArrayResource; @@ -544,7 +543,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory @Test void registerJspServletWithDefaultLoadOnStartup() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0); - factory.addInitializers(servletContext -> servletContext.addServlet("manually-registered-jsp-servlet", JspServlet.class)); + factory.addInitializers((context) -> context.addServlet("manually-registered-jsp-servlet", JspServlet.class)); this.webServer = factory.getWebServer(); this.webServer.start(); }