From 357d072a60234557509d894b548270536fba22be Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 28 Nov 2016 15:14:46 -0800 Subject: [PATCH] Polish --- spring-boot-actuator-docs/pom.xml | 2 +- .../couchbase/CouchbaseAutoConfiguration.java | 8 ++++---- ...MissingBeanWithFilteredClasspathTests.java | 2 +- .../TestDatabaseAutoConfigurationTests.java | 1 - .../boot/loader/jar/Handler.java | 19 +++++++++---------- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/spring-boot-actuator-docs/pom.xml b/spring-boot-actuator-docs/pom.xml index 3b4e86b628d..07e77b0b4c4 100644 --- a/spring-boot-actuator-docs/pom.xml +++ b/spring-boot-actuator-docs/pom.xml @@ -18,11 +18,11 @@ ${basedir}/.. + org.springframework.hateoas spring-hateoas - org.springframework.boot diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java index ca508c8bc52..ea5f0fd5b27 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java @@ -49,8 +49,7 @@ import org.springframework.context.annotation.Primary; public class CouchbaseAutoConfiguration { @Configuration - @ConditionalOnMissingBean(value = CouchbaseConfiguration.class, - type = "org.springframework.data.couchbase.config.CouchbaseConfigurer") + @ConditionalOnMissingBean(value = CouchbaseConfiguration.class, type = "org.springframework.data.couchbase.config.CouchbaseConfigurer") public static class CouchbaseConfiguration { private final CouchbaseProperties properties; @@ -124,8 +123,9 @@ public class CouchbaseAutoConfiguration { * Determine if Couchbase should be configured. This happens if either the * user-configuration defines a {@code CouchbaseConfigurer} or if at least the * "bootstrapHosts" property is specified. - *

The reason why we check for the presence of {@code CouchbaseConfigurer} is - * that it might use {@link CouchbaseProperties} for its internal customization. + *

+ * The reason why we check for the presence of {@code CouchbaseConfigurer} is that it + * might use {@link CouchbaseProperties} for its internal customization. */ static class CouchbaseCondition extends AnyNestedCondition { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanWithFilteredClasspathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanWithFilteredClasspathTests.java index e19f41e09a6..e7cf409d0e4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanWithFilteredClasspathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanWithFilteredClasspathTests.java @@ -53,7 +53,6 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests { assertThat(this.context.containsBean("foo")).isTrue(); } - @Configuration static class OnBeanTypeConfiguration { @@ -66,6 +65,7 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests { } static class TestCacheManager extends CaffeineCacheManager { + } } diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationTests.java index afe99954ce9..8f20b2d2323 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationTests.java @@ -60,7 +60,6 @@ public class TestDatabaseAutoConfigurationTests { DataSource datasource = this.context.getBean(DataSource.class); JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource); jdbcTemplate.execute("create table example (id int, name varchar);"); - ConfigurableApplicationContext anotherContext = doLoad( ExistingDataSourceConfiguration.class); try { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java index 7d801bcbe44..949504b4ff0 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java @@ -198,24 +198,23 @@ public class Handler extends URLStreamHandler { @Override protected int hashCode(URL u) { - int result = 0; - String protocol = u.getProtocol(); - if (protocol != null) { - result += protocol.hashCode(); - } - String file = u.getFile(); + return hashCode(u.getProtocol(), u.getFile()); + } + + private int hashCode(String protocol, String file) { + int result = (protocol == null ? 0 : protocol.hashCode()); int separatorIndex = file.indexOf(SEPARATOR); if (separatorIndex == -1) { return result + file.hashCode(); } - String fileWithoutEntry = file.substring(0, separatorIndex); + String source = file.substring(0, separatorIndex); + String entry = canonicalize(file.substring(separatorIndex + 2)); try { - result += new URL(fileWithoutEntry).hashCode(); + result += new URL(source).hashCode(); } catch (MalformedURLException ex) { - result += fileWithoutEntry.hashCode(); + result += source.hashCode(); } - String entry = canonicalize(file.substring(separatorIndex + 2)); result += entry.hashCode(); return result; }