diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/Token.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/Token.java index 905db882ea5..0e23374f930 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/Token.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/Token.java @@ -61,7 +61,8 @@ public class Token { private Map parseJson(String base64) { try { byte[] bytes = Base64Utils.decodeFromUrlSafeString(base64); - return JsonParserFactory.getJsonParser().parseMap(new String(bytes, StandardCharsets.UTF_8)); + return JsonParserFactory.getJsonParser() + .parseMap(new String(bytes, StandardCharsets.UTF_8)); } catch (RuntimeException ex) { throw new CloudFoundryAuthorizationException(Reason.INVALID_TOKEN, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java index e19b9a77a00..12a0c63a369 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java @@ -50,16 +50,20 @@ public class CompositeHandlerExceptionResolverTests { @Test public void resolverShouldDelegateToOtherResolversInContext() throws Exception { load(TestConfiguration.class); - CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); - ModelAndView resolved = resolver.resolveException(this.request, this.response, null, new HttpRequestMethodNotSupportedException("POST")); + CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context + .getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); + ModelAndView resolved = resolver.resolveException(this.request, this.response, + null, new HttpRequestMethodNotSupportedException("POST")); assertThat(resolved.getViewName()).isEqualTo("test-view"); } @Test public void resolverShouldAddDefaultResolverIfNonePresent() throws Exception { load(BaseConfiguration.class); - CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context.getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); - ModelAndView resolved = resolver.resolveException(this.request, this.response, null, new HttpRequestMethodNotSupportedException("POST")); + CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context + .getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); + ModelAndView resolved = resolver.resolveException(this.request, this.response, + null, new HttpRequestMethodNotSupportedException("POST")); assertThat(resolved).isNotNull(); } @@ -94,7 +98,8 @@ public class CompositeHandlerExceptionResolverTests { static class TestHandlerExceptionResolver implements HandlerExceptionResolver { @Override - public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { + public ModelAndView resolveException(HttpServletRequest request, + HttpServletResponse response, Object handler, Exception ex) { return new ModelAndView("test-view"); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetrics.java index a07a8b0c036..0f4889e37b9 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetrics.java @@ -150,8 +150,8 @@ public class SpringIntegrationMetrics implements MeterBinder, SmartInitializingS private void registerFunctionCounter(MeterRegistry registry, T object, Iterable tags, String name, String description, ToDoubleFunction value) { - FunctionCounter.builder(name, object, value).tags(tags) - .description(description).register(registry); + FunctionCounter.builder(name, object, value).tags(tags).description(description) + .register(registry); } @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java index a014a6a8b77..62249783981 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java @@ -57,7 +57,8 @@ public class ConditionEvaluationReportLoggingListener @Override public void initialize(ConfigurableApplicationContext applicationContext) { this.applicationContext = applicationContext; - applicationContext.addApplicationListener(new ConditionEvaluationReportListener()); + applicationContext + .addApplicationListener(new ConditionEvaluationReportListener()); if (applicationContext instanceof GenericApplicationContext) { // Get the report early in case the context fails to load this.report = ConditionEvaluationReport diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java index 14cab16ab59..cddc4aadfba 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java @@ -147,8 +147,7 @@ public class ConditionEvaluationReportLoggingListenerTests { private void withDebugLogging(Runnable runnable) { LoggerContext context = (LoggerContext) StaticLoggerBinder.getSingleton() .getLoggerFactory(); - Logger logger = context - .getLogger(ConditionEvaluationReportLoggingListener.class); + Logger logger = context.getLogger(ConditionEvaluationReportLoggingListener.class); Level currentLevel = logger.getLevel(); logger.setLevel(Level.DEBUG); try { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTest.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTest.java index 322cf5d21c2..37eb53f3460 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTest.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTest.java @@ -203,10 +203,10 @@ public class DefaultErrorWebExceptionHandlerIntegrationTest { @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented - @Import({ReactiveWebServerAutoConfiguration.class, + @Import({ ReactiveWebServerAutoConfiguration.class, HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class, ErrorWebFluxAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class}) + PropertyPlaceholderAutoConfiguration.class }) private @interface MinimalWebConfiguration { } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java index d66ba17fb38..2845f665b48 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java @@ -54,7 +54,8 @@ public class TestPropertyValuesTests { @Test public void applyToSystemPropertySource() throws Exception { - TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT); + TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, + Type.SYSTEM_ENVIRONMENT); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("BAZ"); assertThat(this.environment.getPropertySources().contains( "test-" + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)); @@ -72,8 +73,8 @@ public class TestPropertyValuesTests { throws Exception { TestPropertyValues.of("foo.bar=baz", "hello.world=hi").applyTo(this.environment, Type.MAP, "other"); - TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT, - "other"); + TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, + Type.SYSTEM_ENVIRONMENT, "other"); assertThat(this.environment.getPropertySources().get("other")) .isInstanceOf(SystemEnvironmentPropertySource.class); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("BAZ"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java index 801569f0841..110754fcf77 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java @@ -155,8 +155,8 @@ class OriginTrackedPropertiesLoader { private int character; CharacterReader(Resource resource) throws IOException { - this.reader = new LineNumberReader( - new InputStreamReader(resource.getInputStream(), StandardCharsets.ISO_8859_1)); + this.reader = new LineNumberReader(new InputStreamReader( + resource.getInputStream(), StandardCharsets.ISO_8859_1)); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java index 0fcf476891b..0b7732b5e7c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java @@ -197,9 +197,8 @@ public class JettyWebServer implements WebServer { private String getContextPath() { return Arrays.stream(this.server.getHandlers()) - .filter(ContextHandler.class::isInstance) - .map(handler -> ((ContextHandler) handler).getContextPath()) - .collect(Collectors.joining(" ")); + .filter(ContextHandler.class::isInstance).map(ContextHandler.class::cast) + .map(ContextHandler::getContextPath).collect(Collectors.joining(" ")); } private void handleDeferredInitialize(Handler... handlers) throws Exception { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java index bc018717ec4..1991243e9f3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java @@ -91,7 +91,8 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact return HttpServer.builder().options((options) -> { options.listenAddress(getListenAddress()); if (getSsl() != null && getSsl().isEnabled()) { - SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(getSsl(), getSslStoreProvider()); + SslServerCustomizer sslServerCustomizer = new SslServerCustomizer( + getSsl(), getSslStoreProvider()); sslServerCustomizer.customize(options); } applyCustomizers(options); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java index 33903d87375..af169d96435 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java @@ -31,8 +31,8 @@ import org.springframework.boot.web.server.SslStoreProvider; import org.springframework.util.ResourceUtils; /** - * {@link NettyServerCustomizer} that configures SSL for the - * given Reactor Netty server instance. + * {@link NettyServerCustomizer} that configures SSL for the given Reactor Netty server + * instance. * * @author Brian Clozel */ @@ -66,7 +66,8 @@ public class SslServerCustomizer implements NettyServerCustomizer { } } - protected KeyManagerFactory getKeyManagerFactory(Ssl ssl, SslStoreProvider sslStoreProvider) { + protected KeyManagerFactory getKeyManagerFactory(Ssl ssl, + SslStoreProvider sslStoreProvider) { try { KeyStore keyStore = getKeyStore(ssl, sslStoreProvider); KeyManagerFactory keyManagerFactory = KeyManagerFactory @@ -84,7 +85,8 @@ public class SslServerCustomizer implements NettyServerCustomizer { } } - private KeyStore getKeyStore(Ssl ssl, SslStoreProvider sslStoreProvider) throws Exception { + private KeyStore getKeyStore(Ssl ssl, SslStoreProvider sslStoreProvider) + throws Exception { if (sslStoreProvider != null) { return sslStoreProvider.getKeyStore(); } @@ -92,7 +94,8 @@ public class SslServerCustomizer implements NettyServerCustomizer { ssl.getKeyStorePassword()); } - protected TrustManagerFactory getTrustManagerFactory(Ssl ssl, SslStoreProvider sslStoreProvider) { + protected TrustManagerFactory getTrustManagerFactory(Ssl ssl, + SslStoreProvider sslStoreProvider) { try { KeyStore store = getTrustStore(ssl, sslStoreProvider); TrustManagerFactory trustManagerFactory = TrustManagerFactory @@ -105,7 +108,8 @@ public class SslServerCustomizer implements NettyServerCustomizer { } } - private KeyStore getTrustStore(Ssl ssl, SslStoreProvider sslStoreProvider) throws Exception { + private KeyStore getTrustStore(Ssl ssl, SslStoreProvider sslStoreProvider) + throws Exception { if (sslStoreProvider != null) { return sslStoreProvider.getTrustStore(); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java index 067a875b76f..028a50c0cfc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java @@ -57,7 +57,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac private String protocol = DEFAULT_PROTOCOL; - private List contextLifecycleListeners = new ArrayList( + private List contextLifecycleListeners = new ArrayList<>( Collections.singleton(new AprLifecycleListener())); private List tomcatContextCustomizers = new ArrayList<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java index c9f8afeaff7..0b3a3e61bbb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java @@ -224,7 +224,8 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto private void configureTldSkipPatterns(TomcatEmbeddedContext context) { StandardJarScanFilter filter = new StandardJarScanFilter(); - filter.setTldSkip(StringUtils.collectionToCommaDelimitedString(this.tldSkipPatterns)); + filter.setTldSkip( + StringUtils.collectionToCommaDelimitedString(this.tldSkipPatterns)); context.getJarScanner().setJarScanFilter(filter); } 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 85e79d062ff..875ce5c3727 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 @@ -329,8 +329,8 @@ public class TomcatWebServer implements WebServer { private String getContextPath() { return Arrays.stream(this.tomcat.getHost().findChildren()) .filter(TomcatEmbeddedContext.class::isInstance) - .map(context -> ((TomcatEmbeddedContext) context).getPath()) - .collect(Collectors.joining(" ")); + .map(TomcatEmbeddedContext.class::cast) + .map(TomcatEmbeddedContext::getPath).collect(Collectors.joining(" ")); } /** 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 4864bada86e..abce754b054 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 @@ -398,7 +398,8 @@ public class TomcatServletWebServerFactoryTests Tomcat tomcat = ((TomcatWebServer) this.webServer).getTomcat(); Context context = (Context) tomcat.getHost().findChildren()[0]; JarScanFilter jarScanFilter = context.getJarScanner().getJarScanFilter(); - Set tldSkipSet = (Set) ReflectionTestUtils.getField(jarScanFilter, "tldSkipSet"); + Set tldSkipSet = (Set) ReflectionTestUtils.getField(jarScanFilter, + "tldSkipSet"); assertThat(tldSkipSet).contains("foo.jar", "bar.jar"); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index 03ec8ad680e..b53dfa2bf20 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -17,7 +17,6 @@ package sample.tomcat; import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.zip.GZIPInputStream; diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java index 33df9fe118e..53d7ee9a0e8 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java @@ -17,7 +17,6 @@ package sample.undertow; import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.zip.GZIPInputStream;