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 48b42b10a6..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 (int i = 0; i < ZIP_FILE_HEADER.length; i++) { - if (inputStream.read() != ZIP_FILE_HEADER[i]) { + 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 941120ff5f..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,14 +543,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory @Test void registerJspServletWithDefaultLoadOnStartup() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0); - factory.addInitializers(new ServletContextInitializer() { - - @Override - public void onStartup(ServletContext servletContext) throws ServletException { - 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(); }