From 335775892b1e05e5ddd2f7cd40c8f26e6e547537 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Wed, 3 Oct 2018 18:30:14 +0900 Subject: [PATCH 1/2] Polish See gh-14667 --- .../metrics/web/reactive/server/WebFluxTags.java | 3 ++- .../actuate/metrics/web/servlet/WebMvcTags.java | 5 +++-- .../neo4j/Neo4jDataAutoConfigurationTests.java | 4 ++-- .../ClassLoaderFilesResourcePatternResolver.java | 2 +- .../spring-boot-gradle-plugin/build.gradle | 8 ++++---- .../context/properties/bind/BindConverter.java | 10 ++++------ .../boot/jdbc/DatabaseDriver.java | 1 + .../devtools/tests/DevToolsIntegrationTests.java | 16 +++++++--------- 8 files changed, 24 insertions(+), 25 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java index 003d19027c..993676c5bc 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java @@ -128,10 +128,11 @@ public final class WebFluxTags { } /** - * Creates a {@code outcome} tag based on the response status of the given + * Creates an {@code outcome} tag based on the response status of the given * {@code exchange}. * @param exchange the exchange * @return the outcome tag derived from the response status + * @since 2.1.0 */ public static Tag outcome(ServerWebExchange exchange) { HttpStatus status = exchange.getResponse().getStatusCode(); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java index d1dddc0611..7bc202ea46 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java @@ -165,9 +165,10 @@ public final class WebMvcTags { } /** - * Creates a {@code outcome} tag based on the status of the given {@code response}. + * Creates an {@code outcome} tag based on the status of the given {@code response}. * @param response the HTTP response * @return the outcome tag derived from the status of the response + * @since 2.1.0 */ public static Tag outcome(HttpServletResponse response) { if (response != null) { @@ -181,7 +182,7 @@ public final class WebMvcTags { if (status < 400) { return OUTCOME_REDIRECTION; } - else if (status < 500) { + if (status < 500) { return OUTCOME_CLIENT_ERROR; } return OUTCOME_SERVER_ERROR; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java index dd4ff2526a..bba4cc5b4c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java @@ -156,7 +156,7 @@ public class Neo4jDataAutoConfigurationTests { } @Test - public void providesARequestScopedBookmarkManangerIfNecessaryAndPossible() { + public void providesARequestScopedBookmarkManagerIfNecessaryAndPossible() { this.contextRunner .withUserConfiguration(BookmarkManagementEnabledConfiguration.class) .run((context) -> { @@ -168,7 +168,7 @@ public class Neo4jDataAutoConfigurationTests { } @Test - public void providesASingletonScopedBookmarkManangerIfNecessaryAndPossible() { + public void providesASingletonScopedBookmarkManagerIfNecessaryAndPossible() { new ApplicationContextRunner() .withUserConfiguration(TestConfiguration.class, BookmarkManagementEnabledConfiguration.class) diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java index 3deed7db9f..b4e0ecb3c7 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java @@ -130,7 +130,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe for (Entry entry : sourceFolder.getFilesEntrySet()) { String name = entry.getKey(); ClassLoaderFile file = entry.getValue(); - if (entry.getValue().getKind() != Kind.DELETED + if (file.getKind() != Kind.DELETED && this.antPathMatcher.match(trimmedLocationPattern, name)) { URL url = new URL("reloaded", null, -1, "/" + name, new ClassLoaderFileURLStreamHandler(file)); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index 0e2c39d5c0..537272b4dd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -22,11 +22,11 @@ repositories { dependencies { implementation localGroovy() - implementation gradleApi() - implementation fileTree(dir: 'target/dependencies/compile', include: '*.jar') + implementation gradleApi() + implementation fileTree(dir: 'target/dependencies/compile', include: '*.jar') testImplementation gradleTestKit() - testImplementation 'org.apache.commons:commons-compress:1.13' - testImplementation fileTree(dir: 'target/dependencies/test', include: '*.jar') + testImplementation 'org.apache.commons:commons-compress:1.13' + testImplementation fileTree(dir: 'target/dependencies/test', include: '*.jar') } jar { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java index c5b60e7584..b292e2bd09 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java @@ -99,17 +99,15 @@ final class BindConverter { new ResolvableTypeDescriptor(type, annotations)); } - public static BindConverter get(ConversionService conversionService, + static BindConverter get(ConversionService conversionService, Consumer propertyEditorInitializer) { if (conversionService == ApplicationConversionService.getSharedInstance() && propertyEditorInitializer == null) { - BindConverter instance = sharedInstance; - if (instance == null) { - instance = new BindConverter(conversionService, + if (sharedInstance == null) { + sharedInstance = new BindConverter(conversionService, propertyEditorInitializer); - sharedInstance = instance; } - return instance; + return sharedInstance; } return new BindConverter(conversionService, propertyEditorInitializer); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index d17e1b47c4..572a290d35 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -101,6 +101,7 @@ public enum DatabaseDriver { /** * SAP - SAP Hana Database - HDB. + * @since 2.1.0 */ SAP("HDB", "com.sap.db.jdbc.Driver", "com.sap.db.jdbcext.XADataSourceSAP", "SELECT 1 FROM DUMMY"), diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 9a141dd7e0..2450cb0678 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -161,15 +161,13 @@ public class DevToolsIntegrationTests { String.class)).isEqualTo("two"); controller("com.example.ControllerOne").withRequestMapping("one") .withRequestMapping("three").build(); - int port = awaitServerPort(); - assertThat( - template.getForObject("http://localhost:" + port + "/one", String.class)) - .isEqualTo("one"); - assertThat( - template.getForObject("http://localhost:" + port + "/two", String.class)) - .isEqualTo("two"); - assertThat(template.getForObject("http://localhost:" + port + "/three", - String.class)).isEqualTo("three"); + urlBase = "http://localhost:" + awaitServerPort(); + assertThat(template.getForObject(urlBase + "/one", String.class)) + .isEqualTo("one"); + assertThat(template.getForObject(urlBase + "/two", String.class)) + .isEqualTo("two"); + assertThat(template.getForObject(urlBase + "/three", String.class)) + .isEqualTo("three"); } @Test From 0eae32371f1dbc294f26a32a44a18160518352cd Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 3 Oct 2018 13:59:32 +0200 Subject: [PATCH 2/2] Polish contribution Closes gh-14667 --- .../boot/devtools/tests/DevToolsIntegrationTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 2450cb0678..038f11e196 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.