Format with Eclipse Oxygen SR2

This commit is contained in:
Phillip Webb 2018-02-08 15:46:49 -08:00
parent 1f8bc391ce
commit 798522d890
62 changed files with 138 additions and 144 deletions

View File

@ -89,9 +89,8 @@ public class PublicMetricsAutoConfiguration {
@Bean @Bean
public MetricReaderPublicMetrics metricReaderPublicMetrics() { public MetricReaderPublicMetrics metricReaderPublicMetrics() {
return new MetricReaderPublicMetrics( return new MetricReaderPublicMetrics(new CompositeMetricReader(
new CompositeMetricReader(this.metricReaders == null ? new MetricReader[0] this.metricReaders == null ? new MetricReader[0] : this.metricReaders
: this.metricReaders
.toArray(new MetricReader[this.metricReaders.size()]))); .toArray(new MetricReader[this.metricReaders.size()])));
} }

View File

@ -89,9 +89,8 @@ public class CloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api"); String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = cloudFoundryProperties boolean skipSslValidation = cloudFoundryProperties
.getProperty("skip-ssl-validation", Boolean.class, false); .getProperty("skip-ssl-validation", Boolean.class, false);
return cloudControllerUrl == null ? null return cloudControllerUrl == null ? null : new CloudFoundrySecurityService(
: new CloudFoundrySecurityService(restTemplateBuilder, cloudControllerUrl, restTemplateBuilder, cloudControllerUrl, skipSslValidation);
skipSslValidation);
} }
private CorsConfiguration getCorsConfiguration() { private CorsConfiguration getCorsConfiguration() {

View File

@ -104,8 +104,8 @@ public class AuditEventsMvcEndpointTests {
@Test @Test
public void invokeFilterByPrincipalAndDateAfter() throws Exception { public void invokeFilterByPrincipalAndDateAfter() throws Exception {
this.mvc.perform(get("/auditevents").param("principal", "user").param("after", this.mvc.perform(get("/auditevents")
"2016-11-01T10:00:00+0000")) .param("principal", "user").param("after", "2016-11-01T10:00:00+0000"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().string( .andExpect(content().string(
containsString("\"principal\":\"user\",\"type\":\"login\""))) containsString("\"principal\":\"user\",\"type\":\"login\"")))

View File

@ -69,7 +69,8 @@ public enum CacheType {
/** /**
* Guava backed caching. * Guava backed caching.
*/ */
@Deprecated GUAVA, @Deprecated
GUAVA,
/** /**
* Simple in-memory caching. * Simple in-memory caching.

View File

@ -60,9 +60,8 @@ public class CouchbaseCacheConfiguration {
public CouchbaseCacheManager cacheManager() { public CouchbaseCacheManager cacheManager() {
List<String> cacheNames = this.cacheProperties.getCacheNames(); List<String> cacheNames = this.cacheProperties.getCacheNames();
CouchbaseCacheManager cacheManager = new CouchbaseCacheManager( CouchbaseCacheManager cacheManager = new CouchbaseCacheManager(
CacheBuilder.newInstance(this.bucket) CacheBuilder.newInstance(this.bucket).withExpiration(
.withExpiration(this.cacheProperties.getCouchbase() this.cacheProperties.getCouchbase().getExpirationSeconds()),
.getExpirationSeconds()),
cacheNames.toArray(new String[cacheNames.size()])); cacheNames.toArray(new String[cacheNames.size()]));
return this.customizers.customize(cacheManager); return this.customizers.customize(cacheManager);
} }

View File

@ -32,7 +32,8 @@ public enum SearchStrategy {
* Search all parents and ancestors, but not the current context. * Search all parents and ancestors, but not the current context.
* @deprecated as of 1.5 in favor of {@link SearchStrategy#ANCESTORS} * @deprecated as of 1.5 in favor of {@link SearchStrategy#ANCESTORS}
*/ */
@Deprecated PARENTS, @Deprecated
PARENTS,
/** /**
* Search all ancestors, but not the current context. * Search all ancestors, but not the current context.

View File

@ -109,9 +109,8 @@ public class FlywayAutoConfiguration {
Assert.state(!this.properties.getLocations().isEmpty(), Assert.state(!this.properties.getLocations().isEmpty(),
"Migration script locations not configured"); "Migration script locations not configured");
boolean exists = hasAtLeastOneLocation(); boolean exists = hasAtLeastOneLocation();
Assert.state(exists, Assert.state(exists, "Cannot find migrations location in: "
"Cannot find migrations location in: " + this.properties + this.properties.getLocations()
.getLocations()
+ " (please add migrations or check your Flyway configuration)"); + " (please add migrations or check your Flyway configuration)");
} }
} }

View File

@ -41,8 +41,8 @@ class EnableOAuth2SsoCondition extends SpringBootCondition {
for (String name : enablers) { for (String name : enablers) {
if (context.getBeanFactory().isTypeMatch(name, if (context.getBeanFactory().isTypeMatch(name,
WebSecurityConfigurerAdapter.class)) { WebSecurityConfigurerAdapter.class)) {
return ConditionOutcome.match(message return ConditionOutcome.match(message.found(
.found("@EnableOAuth2Sso annotation on WebSecurityConfigurerAdapter") "@EnableOAuth2Sso annotation on WebSecurityConfigurerAdapter")
.items(name)); .items(name));
} }
} }

View File

@ -288,10 +288,9 @@ public class WebMvcAutoConfiguration {
} }
Integer cachePeriod = this.resourceProperties.getCachePeriod(); Integer cachePeriod = this.resourceProperties.getCachePeriod();
if (!registry.hasMappingForPattern("/webjars/**")) { if (!registry.hasMappingForPattern("/webjars/**")) {
customizeResourceHandlerRegistration( customizeResourceHandlerRegistration(registry
registry.addResourceHandler("/webjars/**") .addResourceHandler("/webjars/**")
.addResourceLocations( .addResourceLocations("classpath:/META-INF/resources/webjars/")
"classpath:/META-INF/resources/webjars/")
.setCachePeriod(cachePeriod)); .setCachePeriod(cachePeriod));
} }
String staticPathPattern = this.mvcProperties.getStaticPathPattern(); String staticPathPattern = this.mvcProperties.getStaticPathPattern();

View File

@ -194,15 +194,17 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
} }
private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) { private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) {
assertThat(analysis.getAction()).startsWith(String assertThat(analysis.getAction()).startsWith(String.format(
.format("Consider revisiting the conditions above or defining a bean of type '%s' " "Consider revisiting the conditions above or defining a bean of type '%s' "
+ "in your configuration.", type.getName())); + "in your configuration.",
type.getName()));
} }
private void assertActionMissingName(FailureAnalysis analysis, String name) { private void assertActionMissingName(FailureAnalysis analysis, String name) {
assertThat(analysis.getAction()).startsWith(String assertThat(analysis.getAction()).startsWith(String.format(
.format("Consider revisiting the conditions above or defining a bean named '%s' " "Consider revisiting the conditions above or defining a bean named '%s' "
+ "in your configuration.", name)); + "in your configuration.",
name));
} }
private void assertBeanMethodDisabled(FailureAnalysis analysis, String description, private void assertBeanMethodDisabled(FailureAnalysis analysis, String description,

View File

@ -140,11 +140,10 @@ public class DataSourceInitializerTests {
@Test @Test
public void testDataSourceInitializedWithMultipleScripts() throws Exception { public void testDataSourceInitializedWithMultipleScripts() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils
"spring.datasource.initialize:true", .addEnvironment(this.context, "spring.datasource.initialize:true",
"spring.datasource.schema:" "spring.datasource.schema:" + ClassUtils
+ ClassUtils.addResourcePathToPackagePath(getClass(), .addResourcePathToPackagePath(getClass(), "schema.sql")
"schema.sql")
+ "," + ","
+ ClassUtils.addResourcePathToPackagePath(getClass(), + ClassUtils.addResourcePathToPackagePath(getClass(),
"another.sql"), "another.sql"),

View File

@ -104,8 +104,10 @@ public class SecurityAutoConfigurationTests {
ServerPropertiesAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean("securityFilterChainRegistration", assertThat(this.context
DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo( .getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100); FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
} }
@ -134,8 +136,10 @@ public class SecurityAutoConfigurationTests {
ServerPropertiesAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean("securityFilterChainRegistration", assertThat(this.context
DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo( .getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100); FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
} }

View File

@ -38,8 +38,7 @@ public class SpringSecurityCompilerAutoConfiguration extends CompilerAutoConfigu
@Override @Override
public void applyDependencies(DependencyCustomizer dependencies) { public void applyDependencies(DependencyCustomizer dependencies) {
dependencies dependencies.ifAnyMissingClasses(
.ifAnyMissingClasses(
"org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity") "org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity")
.add("spring-boot-starter-security"); .add("spring-boot-starter-security");
} }

View File

@ -38,8 +38,7 @@ public class SpringWebsocketCompilerAutoConfiguration extends CompilerAutoConfig
@Override @Override
public void applyDependencies(DependencyCustomizer dependencies) { public void applyDependencies(DependencyCustomizer dependencies) {
dependencies dependencies.ifAnyMissingClasses(
.ifAnyMissingClasses(
"org.springframework.web.socket.config.annotation.EnableWebSocket") "org.springframework.web.socket.config.annotation.EnableWebSocket")
.add("spring-boot-starter-websocket").add("spring-messaging"); .add("spring-boot-starter-websocket").add("spring-messaging");
} }

View File

@ -94,8 +94,7 @@ public class AetherGrapeEngine implements GrapeEngine {
private ProgressReporter getProgressReporter(DefaultRepositorySystemSession session, private ProgressReporter getProgressReporter(DefaultRepositorySystemSession session,
boolean quiet) { boolean quiet) {
String progressReporter = (quiet ? "none" String progressReporter = (quiet ? "none" : System.getProperty(
: System.getProperty(
"org.springframework.boot.cli.compiler.grape.ProgressReporter")); "org.springframework.boot.cli.compiler.grape.ProgressReporter"));
if ("detail".equals(progressReporter) if ("detail".equals(progressReporter)
|| Boolean.getBoolean("groovy.grape.report.downloads")) { || Boolean.getBoolean("groovy.grape.report.downloads")) {

View File

@ -105,9 +105,8 @@ public class DependencyResolutionContext {
aetherDependency); aetherDependency);
} }
this.dependencyManagement = this.dependencyManagement == null this.dependencyManagement = this.dependencyManagement == null
? dependencyManagement ? dependencyManagement : new CompositeDependencyManagement(
: new CompositeDependencyManagement(dependencyManagement, dependencyManagement, this.dependencyManagement);
this.dependencyManagement);
this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver( this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver(
this.dependencyManagement); this.dependencyManagement);
} }

View File

@ -47,8 +47,8 @@ public abstract class GroovyTemplate {
} }
public static String template(TemplateEngine engine, String name, public static String template(TemplateEngine engine, String name,
Map<String, ?> model) throws IOException, CompilationFailedException, Map<String, ?> model)
ClassNotFoundException { throws IOException, CompilationFailedException, ClassNotFoundException {
Writable writable = getTemplate(engine, name).make(model); Writable writable = getTemplate(engine, name).make(model);
StringWriter result = new StringWriter(); StringWriter result = new StringWriter();
writable.writeTo(result); writable.writeTo(result);

View File

@ -51,7 +51,8 @@ public class TomcatLegacyCookieProcessorExample {
@Override @Override
public void customize(Context context) { public void customize(Context context) {
context.setCookieProcessor(new LegacyCookieProcessor()); context.setCookieProcessor(
new LegacyCookieProcessor());
} }
}); });

View File

@ -68,8 +68,8 @@ public class SampleDataRestApplicationTests {
@Test @Test
public void findByNameAndCountry() throws Exception { public void findByNameAndCountry() throws Exception {
this.mvc.perform( this.mvc.perform(get(
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia")) "/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("state", equalTo("Victoria"))) .andExpect(jsonPath("state", equalTo("Victoria")))
.andExpect(jsonPath("name", equalTo("Melbourne"))); .andExpect(jsonPath("name", equalTo("Melbourne")));
@ -78,8 +78,8 @@ public class SampleDataRestApplicationTests {
@Test @Test
public void findByContaining() throws Exception { public void findByContaining() throws Exception {
this.mvc.perform( this.mvc.perform(get(
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK")) "/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("_embedded.cities", hasSize(3))); .andExpect(jsonPath("_embedded.cities", hasSize(3)));
} }

View File

@ -52,8 +52,8 @@ import java.util.List;
* Each stringer may be used to encode a single top level value. Instances of this class * Each stringer may be used to encode a single top level value. Instances of this class
* are not thread safe. Although this class is nonfinal, it was not designed for * are not thread safe. Although this class is nonfinal, it was not designed for
* inheritance and should not be subclassed. In particular, self-use by overrideable * inheritance and should not be subclassed. In particular, self-use by overrideable
* methods is not specified. See <i>Effective Java</i> Item 17, * methods is not specified. See <i>Effective Java</i> Item 17, "Design and Document or
* "Design and Document or inheritance or else prohibit it" for further information. * inheritance or else prohibit it" for further information.
*/ */
public class JSONStringer { public class JSONStringer {

View File

@ -54,8 +54,8 @@ package org.springframework.boot.configurationprocessor.json;
* Each tokener may be used to parse a single JSON string. Instances of this class are not * Each tokener may be used to parse a single JSON string. Instances of this class are not
* thread safe. Although this class is nonfinal, it was not designed for inheritance and * thread safe. Although this class is nonfinal, it was not designed for inheritance and
* should not be subclassed. In particular, self-use by overrideable methods is not * should not be subclassed. In particular, self-use by overrideable methods is not
* specified. See <i>Effective Java</i> Item 17, * specified. See <i>Effective Java</i> Item 17, "Design and Document or inheritance or
* "Design and Document or inheritance or else prohibit it" for further information. * else prohibit it" for further information.
*/ */
public class JSONTokener { public class JSONTokener {

View File

@ -380,16 +380,12 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class); ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps") assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
.fromSource(ClassWithNestedProperties.NestedChildClass.class)); .fromSource(ClassWithNestedProperties.NestedChildClass.class));
assertThat(metadata) assertThat(metadata).has(Metadata
.has(Metadata .withProperty("nestedChildProps.child-class-property", Integer.class)
.withProperty("nestedChildProps.child-class-property",
Integer.class)
.fromSource(ClassWithNestedProperties.NestedChildClass.class) .fromSource(ClassWithNestedProperties.NestedChildClass.class)
.withDefaultValue(20)); .withDefaultValue(20));
assertThat(metadata) assertThat(metadata).has(Metadata
.has(Metadata .withProperty("nestedChildProps.parent-class-property", Integer.class)
.withProperty("nestedChildProps.parent-class-property",
Integer.class)
.fromSource(ClassWithNestedProperties.NestedChildClass.class) .fromSource(ClassWithNestedProperties.NestedChildClass.class)
.withDefaultValue(10)); .withDefaultValue(10));
} }

View File

@ -320,7 +320,8 @@ public class SpringBootPluginExtension {
* Module Layout. * Module Layout.
* @deprecated as of 1.5 in favor of a custom {@link LayoutFactory} * @deprecated as of 1.5 in favor of a custom {@link LayoutFactory}
*/ */
@Deprecated MODULE(new Layouts.Module()), @Deprecated
MODULE(new Layouts.Module()),
/** /**
* No layout. * No layout.

View File

@ -64,8 +64,8 @@ public class RandomAccessDataFile implements RandomAccessData {
throw new IllegalArgumentException("File must not be null"); throw new IllegalArgumentException("File must not be null");
} }
if (!file.exists()) { if (!file.exists()) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(
"File %s must exist", file.getAbsolutePath())); String.format("File %s must exist", file.getAbsolutePath()));
} }
this.file = file; this.file = file;
this.filePool = new FilePool(file, concurrentReads); this.filePool = new FilePool(file, concurrentReads);

View File

@ -125,10 +125,8 @@ public class JarFileArchiveTests {
File nested = new File(this.archive File nested = new File(this.archive
.getNestedArchive(getEntriesMap(this.archive).get("nested.jar")).getUrl() .getNestedArchive(getEntriesMap(this.archive).get("nested.jar")).getUrl()
.toURI()); .toURI());
File anotherNested = new File( File anotherNested = new File(this.archive
this.archive .getNestedArchive(getEntriesMap(this.archive).get("another-nested.jar"))
.getNestedArchive(
getEntriesMap(this.archive).get("another-nested.jar"))
.getUrl().toURI()); .getUrl().toURI());
assertThat(nested.getParent()).isEqualTo(anotherNested.getParent()); assertThat(nested.getParent()).isEqualTo(anotherNested.getParent());
} }

View File

@ -355,7 +355,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
* Module Layout. * Module Layout.
* @deprecated as of 1.5 in favor of a custom {@link LayoutFactory} * @deprecated as of 1.5 in favor of a custom {@link LayoutFactory}
*/ */
@Deprecated MODULE(new Layouts.Module()), @Deprecated
MODULE(new Layouts.Module()),
/** /**
* No Layout. * No Layout.

View File

@ -30,9 +30,8 @@ public class TestServlet extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { throws ServletException, IOException {
resp.getWriter() resp.getWriter().print(
.print(((String) req.getServletContext() ((String) req.getServletContext().getAttribute("listenerAttribute")) + " "
.getAttribute("listenerAttribute")) + " "
+ req.getAttribute("filterAttribute")); + req.getAttribute("filterAttribute"));
resp.getWriter().flush(); resp.getWriter().flush();
} }