From 29c3be3590c448476f8b1e8168cf3a1bfb98e67e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 26 Feb 2018 10:23:23 -0800 Subject: [PATCH] Polish --- ...erseyManagementChildContextConfiguration.java | 2 +- .../ControllerEndpointHandlerMapping.java | 2 +- .../servlet/TraceableHttpServletRequest.java | 2 +- .../condition/ConditionMessage.java | 3 +-- .../ElasticsearchAutoConfiguration.java | 2 +- .../session/SessionAutoConfiguration.java | 10 +++++----- .../aop/AopAutoConfigurationTests.java | 2 +- .../MessageSourceAutoConfigurationTests.java | 12 ++++-------- .../redis/RedisAutoConfigurationJedisTests.java | 16 ++++++++++------ ...utoConfigurationReactiveIntegrationTests.java | 4 ++-- .../ReactiveWebServerFactoryCustomizerTests.java | 3 +-- .../ServletWebServerFactoryCustomizerTests.java | 3 +-- ...ringApplicationWebApplicationInitializer.java | 2 +- .../boot/cli/command/archive/ArchiveCommand.java | 7 ++++--- .../cli/compiler/grape/AetherGrapeEngine.java | 5 ++--- .../boot/cli/util/ResourceUtils.java | 2 +- .../classloader/RestartClassLoaderTests.java | 2 +- .../CloudFoundryCustomContextPathExample.java | 12 ++++++++---- .../configurationprocessor/MetadataStore.java | 10 +++++----- .../boot/gradle/plugin/JavaPluginAction.java | 5 ++--- .../boot/loader/tools/JarWriter.java | 4 ++-- .../boot/loader/tools/RepackagerTests.java | 3 +-- .../springframework/boot/loader/jar/JarFile.java | 2 +- .../boot/loader/util/SystemPropertyUtils.java | 7 ++++--- .../SpringPackageScanClassResolver.java | 2 +- .../springframework/boot/util/LambdaSafe.java | 4 ++-- .../java/sample/ant/SampleAntApplicationIT.java | 8 +++++--- 27 files changed, 69 insertions(+), 67 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/jersey/JerseyManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/jersey/JerseyManagementChildContextConfiguration.java index 4e66aa867a..ef279968a6 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/jersey/JerseyManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/jersey/JerseyManagementChildContextConfiguration.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. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java index 342bb22505..4661fde59e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMapping.java @@ -95,7 +95,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi ExposableControllerEndpoint endpoint, RequestMappingInfo mapping) { Set patterns = mapping.getPatternsCondition().getPatterns(); if (patterns.isEmpty()) { - patterns = new HashSet( + patterns = new HashSet<>( Arrays.asList(getPathPatternParser().parse(""))); } PathPattern[] endpointMappedPatterns = patterns.stream() diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/TraceableHttpServletRequest.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/TraceableHttpServletRequest.java index 02f0b31ddb..4077c05dfc 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/TraceableHttpServletRequest.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/TraceableHttpServletRequest.java @@ -77,7 +77,7 @@ final class TraceableHttpServletRequest implements TraceableRequest { } private List toList(Enumeration enumeration) { - List list = new ArrayList(); + List list = new ArrayList<>(); while (enumeration.hasMoreElements()) { list.add(enumeration.nextElement()); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index e2d472815c..a1181bed38 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -358,8 +358,7 @@ public final class ConditionMessage { * @return a built {@link ConditionMessage} */ public ConditionMessage items(Style style, Object... items) { - return items(style, - items == null ? null : Arrays.asList(items)); + return items(style, items == null ? null : Arrays.asList(items)); } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java index 040dfba616..ab292f2d3d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java index 7edbfe2cbe..e500fdd89c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java @@ -250,11 +250,11 @@ public class SessionAutoConfiguration { if (storeType != StoreType.NONE && this.sessionRepositoryProvider.getIfAvailable() == null) { if (storeType != null) { - throw new SessionRepositoryUnavailableException("No session " - + "repository could be auto-configured, check your " - + "configuration (session store type is '" - + storeType.name().toLowerCase(Locale.ENGLISH) - + "')", storeType); + throw new SessionRepositoryUnavailableException( + "No session repository could be auto-configured, check your " + + "configuration (session store type is '" + + storeType.name().toLowerCase(Locale.ENGLISH) + "')", + storeType); } } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java index 6828092c21..27b81dd774 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java index 810e765de3..052dd52a8b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java @@ -86,18 +86,14 @@ public class MessageSourceAutoConfigurationTests { @Test public void testCacheDurationNoUnit() { - this.contextRunner - .withPropertyValues("spring.messages.basename:test/messages", - "spring.messages.cache-duration=10") - .run(assertCache(10 * 1000)); + this.contextRunner.withPropertyValues("spring.messages.basename:test/messages", + "spring.messages.cache-duration=10").run(assertCache(10 * 1000)); } @Test public void testCacheDurationWithUnit() { - this.contextRunner - .withPropertyValues("spring.messages.basename:test/messages", - "spring.messages.cache-duration=1m") - .run(assertCache(60 * 1000)); + this.contextRunner.withPropertyValues("spring.messages.basename:test/messages", + "spring.messages.cache-duration=1m").run(assertCache(60 * 1000)); } private ContextConsumer assertCache(long expected) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java index 6940bb9155..801311f226 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java @@ -47,7 +47,8 @@ public class RedisAutoConfigurationJedisTests { @Test public void testOverrideRedisConfiguration() { - this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1") + this.contextRunner + .withPropertyValues("spring.redis.host:foo", "spring.redis.database:1") .run((context) -> { JedisConnectionFactory cf = context .getBean(JedisConnectionFactory.class); @@ -60,10 +61,12 @@ public class RedisAutoConfigurationJedisTests { @Test public void testCustomizeRedisConfiguration() { - this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> { - JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); - assertThat(cf.isUseSsl()).isTrue(); - }); + this.contextRunner.withUserConfiguration(CustomConfiguration.class) + .run((context) -> { + JedisConnectionFactory cf = context + .getBean(JedisConnectionFactory.class); + assertThat(cf.isUseSsl()).isTrue(); + }); } @Test @@ -99,7 +102,8 @@ public class RedisAutoConfigurationJedisTests { @Test public void testPasswordInUrlWithColon() { - this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33") + this.contextRunner + .withPropertyValues("spring.redis.url:redis://:pass:word@example:33") .run((context) -> { assertThat( context.getBean(JedisConnectionFactory.class).getHostName()) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java index 052f6e8123..5a362f802a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java @@ -72,8 +72,8 @@ public class MustacheAutoConfigurationReactiveIntegrationTests { } @Configuration - @Import({ ReactiveWebServerFactoryAutoConfiguration.class, WebFluxAutoConfiguration.class, - HttpHandlerAutoConfiguration.class, + @Import({ ReactiveWebServerFactoryAutoConfiguration.class, + WebFluxAutoConfiguration.class, HttpHandlerAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) @Controller public static class Application { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java index 53bcdaedc8..d2d33b8ee0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizerTests.java @@ -42,8 +42,7 @@ public class ReactiveWebServerFactoryCustomizerTests { @Before public void setup() { - this.customizer = new ReactiveWebServerFactoryCustomizer( - this.properties); + this.customizer = new ReactiveWebServerFactoryCustomizer(this.properties); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryCustomizerTests.java index 6b1a06be77..e85ec09d54 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryCustomizerTests.java @@ -62,8 +62,7 @@ public class ServletWebServerFactoryCustomizerTests { @Before public void setup() { MockitoAnnotations.initMocks(this); - this.customizer = new ServletWebServerFactoryCustomizer( - this.properties); + this.customizer = new ServletWebServerFactoryCustomizer(this.properties); } @Test diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java index d800fb5d17..6aa2bf91cd 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.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. diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index 1b2c2faabc..91937e186f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java @@ -129,9 +129,10 @@ abstract class ArchiveCommand extends OptionParsingCommand { File output = new File((String) nonOptionArguments.remove(0)); Assert.isTrue( - output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type), - "The output '" + output + "' is not a " + this.type.toUpperCase( - Locale.ENGLISH) + " file."); + output.getName().toLowerCase(Locale.ENGLISH) + .endsWith("." + this.type), + "The output '" + output + "' is not a " + + this.type.toUpperCase(Locale.ENGLISH) + " file."); deleteIfExists(output); GroovyCompiler compiler = createCompiler(options); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index 5c9ce72ec3..abb9f16c29 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -324,9 +324,8 @@ public class AetherGrapeEngine implements GrapeEngine { } private DependencyRequest getDependencyRequest(CollectRequest collectRequest) { - return new DependencyRequest(collectRequest, - DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE, - JavaScopes.RUNTIME)); + return new DependencyRequest(collectRequest, DependencyFilterUtils + .classpathFilter(JavaScopes.COMPILE, JavaScopes.RUNTIME)); } private void addManagedDependencies(DependencyResult result) { diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java index 1589c83918..c64a8afb3d 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.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. diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java index f5ee4c6638..be50d95ffe 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.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. diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java index 76042eb298..2672a0b5b6 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java @@ -48,12 +48,14 @@ public class CloudFoundryCustomContextPathExample { return new TomcatServletWebServerFactory() { @Override - protected void prepareContext(Host host, ServletContextInitializer[] initializers) { + protected void prepareContext(Host host, + ServletContextInitializer[] initializers) { super.prepareContext(host, initializers); StandardContext child = new StandardContext(); child.addLifecycleListener(new Tomcat.FixContextListener()); child.setPath("/cloudfoundryapplication"); - ServletContainerInitializer initializer = getServletContextInitializer(getContextPath()); + ServletContainerInitializer initializer = getServletContextInitializer( + getContextPath()); child.addServletContainerInitializer(initializer, Collections.emptySet()); child.setCrossContext(true); host.addChild(child); @@ -69,8 +71,10 @@ public class CloudFoundryCustomContextPathExample { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - ServletContext context = req.getServletContext().getContext(contextPath); - context.getRequestDispatcher("/cloudfoundryapplication").forward(req, res); + ServletContext context = req.getServletContext() + .getContext(contextPath); + context.getRequestDispatcher("/cloudfoundryapplication").forward(req, + res); } }; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java index f917107b1a..d13157f16a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.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. @@ -95,13 +95,13 @@ public class MetadataStore { } private FileObject getMetadataResource() throws IOException { - return this.environment.getFiler() - .getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + return this.environment.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", + METADATA_PATH); } private FileObject createMetadataResource() throws IOException { - return this.environment.getFiler() - .createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH); + return this.environment.getFiler().createResource(StandardLocation.CLASS_OUTPUT, + "", METADATA_PATH); } private InputStream getAdditionalMetadataStream() throws IOException { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java index 04f9f65700..83c31c37bd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java @@ -140,9 +140,8 @@ final class JavaPluginAction implements PluginApplicationAction { } private void configureAdditionalMetadataLocations(Project project) { - project.afterEvaluate((evaluated) -> - evaluated.getTasks().withType(JavaCompile.class, - this::configureAdditionalMetadataLocations)); + project.afterEvaluate((evaluated) -> evaluated.getTasks() + .withType(JavaCompile.class, this::configureAdditionalMetadataLocations)); } private void configureAdditionalMetadataLocations(JavaCompile compile) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index f1feef75ad..79cb32b789 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -247,8 +247,8 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable { } /** - * Perform the actual write of a {@link JarEntry}. All other write methods - * delegate to this one. + * Perform the actual write of a {@link JarEntry}. All other write methods delegate to + * this one. * @param entry the entry to write * @param entryWriter the entry writer or {@code null} if there is no content * @param unpackHandler handles possible unpacking for the entry diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java index 16fb967ba6..e157f00d3d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java @@ -208,8 +208,7 @@ public class RepackagerTests { repackager.setLayout(new Layouts.None()); repackager.repackage(file, NO_LIBRARIES); Manifest actualManifest = getManifest(file); - assertThat(actualManifest.getMainAttributes().getValue("Main-Class")) - .isNull(); + assertThat(actualManifest.getMainAttributes().getValue("Main-Class")).isNull(); assertThat(hasLauncherClasses(file)).isFalse(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index e86ab49755..80e5a0b75f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -108,7 +108,7 @@ public class JarFile extends java.util.jar.JarFile { private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data, JarEntryFilter filter, JarFileType type) - throws IOException { + throws IOException { super(rootFile.getFile()); this.rootFile = rootFile; this.pathFromRoot = pathFromRoot; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index 3dd2b4ea59..f76ed84dfd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java @@ -185,12 +185,13 @@ public abstract class SystemPropertyUtils { } if (propVal == null) { // Try with underscores. - propVal = System.getenv(key.replace('.', '_')); + String name = key.replace('.', '_'); + propVal = System.getenv(name); } if (propVal == null) { // Try uppercase with underscores as well. - propVal = System.getenv(key.toUpperCase(Locale.ENGLISH) - .replace('.', '_')); + String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_'); + propVal = System.getenv(name); } if (propVal != null) { return propVal; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java index cc9811860e..b2c94c6aa9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.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. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java index 04c8545306..13b878e1ad 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java @@ -110,7 +110,7 @@ public final class LambdaSafe { private Log logger; - private Filter filter = new GenericTypeFilter(); + private Filter filter = new GenericTypeFilter<>(); protected LambdaSafeCallback(Class callbackType, A argument, Object[] additionalArguments) { @@ -414,7 +414,7 @@ public final class LambdaSafe { * @return an {@link InvocationResult} */ public static InvocationResult of(R value) { - return new InvocationResult(value); + return new InvocationResult<>(value); } /** diff --git a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java index bdc4e027ef..2546037cb2 100644 --- a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java +++ b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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. @@ -47,10 +47,12 @@ public class SampleAntApplicationIT { }); assertThat(jarFiles).hasSize(1); - Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start(); + Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0] + .getName()).directory(target).start(); process.waitFor(5, TimeUnit.MINUTES); assertThat(process.exitValue()).isEqualTo(0); - String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream())); + String output = FileCopyUtils.copyToString(new InputStreamReader(process + .getInputStream())); assertThat(output).contains("Spring Boot Ant Example"); }