From 55f5f2f910f829f8f4d597dbc4fea91e995cf2e0 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 19 Feb 2019 11:36:57 +0900 Subject: [PATCH] Polish Closes gh-15987 --- .../error/AbstractErrorWebExceptionHandler.java | 8 ++++---- .../HttpMessageConvertersAutoConfigurationTests.java | 2 +- .../jersey/JerseyAutoConfigurationTests.java | 2 +- .../client/RestTemplateAutoConfigurationTests.java | 2 +- .../ConditionEvaluationDeltaLoggingListener.java | 12 +++++------- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java index bf30331693..b913e93591 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java @@ -268,10 +268,10 @@ public abstract class AbstractErrorWebExceptionHandler private boolean isDisconnectedClientError(Throwable ex) { String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage(); - message = (message != null) ? message.toLowerCase() : ""; - String className = ex.getClass().getSimpleName(); - return (message.contains("broken pipe") - || DISCONNECTED_CLIENT_EXCEPTIONS.contains(className)); + if (message != null && message.toLowerCase().contains("broken pipe")) { + return true; + } + return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName()); } private void logError(ServerRequest request, ServerResponse response, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java index 2acebe9c54..93cd86be7e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java @@ -269,7 +269,7 @@ public class HttpMessageConvertersAutoConfigurationTests { } @Test - public void whenReactiveWebApplicationHttpMessageConvertersRestTemplateIsNotConfigured() { + public void whenReactiveWebApplicationHttpMessageConvertersIsNotConfigured() { new ReactiveWebApplicationContextRunner() .withConfiguration(AutoConfigurations .of(HttpMessageConvertersAutoConfiguration.class)) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java index 1600e07390..c13e44975e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java @@ -40,7 +40,7 @@ public class JerseyAutoConfigurationTests { private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() .withConfiguration(AutoConfigurations.of(JerseyAutoConfiguration.class)) .withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) - .withUserConfiguration(ResourceConfig.class); + .withUserConfiguration(ResourceConfigConfiguration.class); @Test public void requestContextFilterRegistrationIsAutoConfigured() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java index bd499fc9d7..6d4bf7dcb7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java @@ -136,7 +136,7 @@ public class RestTemplateAutoConfigurationTests { } @Test - public void whenReactiveWebApplicationRestTemplateIsNotConfigured() { + public void whenReactiveWebApplicationRestTemplateBuilderIsNotConfigured() { new ReactiveWebApplicationContextRunner() .withConfiguration( AutoConfigurations.of(RestTemplateAutoConfiguration.class)) diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java index fcc2a849eb..9def08e118 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java @@ -58,16 +58,14 @@ class ConditionEvaluationDeltaLoggingListener if (!delta.getConditionAndOutcomesBySource().isEmpty() || !delta.getExclusions().isEmpty() || !delta.getUnconditionalClasses().isEmpty()) { - if (ConditionEvaluationDeltaLoggingListener.logger.isInfoEnabled()) { - ConditionEvaluationDeltaLoggingListener.logger - .info("Condition evaluation delta:" - + new ConditionEvaluationReportMessage(delta, - "CONDITION EVALUATION DELTA")); + if (logger.isInfoEnabled()) { + logger.info("Condition evaluation delta:" + + new ConditionEvaluationReportMessage(delta, + "CONDITION EVALUATION DELTA")); } } else { - ConditionEvaluationDeltaLoggingListener.logger - .info("Condition evaluation unchanged"); + logger.info("Condition evaluation unchanged"); } } previousReports.put(event.getApplicationContext().getId(), report);