Skip to content

Commit f49b16c

Browse files
committed
Upgrade to Spring Java Format 0.0.34
Closes gh-31524
1 parent 53da5e8 commit f49b16c

File tree

30 files changed

+427
-426
lines changed

30 files changed

+427
-426
lines changed

buildSrc/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
javaFormatVersion=0.0.33
1+
javaFormatVersion=0.0.34

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroup.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -96,12 +96,12 @@ public boolean showDetails(SecurityContext securityContext) {
9696

9797
private boolean getShowResult(SecurityContext securityContext, Show show) {
9898
switch (show) {
99-
case NEVER:
100-
return false;
101-
case ALWAYS:
102-
return true;
103-
case WHEN_AUTHORIZED:
104-
return isAuthorized(securityContext);
99+
case NEVER:
100+
return false;
101+
case ALWAYS:
102+
return true;
103+
case WHEN_AUTHORIZED:
104+
return isAuthorized(securityContext);
105105
}
106106
throw new IllegalStateException("Unsupported 'show' value " + show);
107107
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpoint.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -77,34 +77,34 @@ private ErrorAttributeOptions getErrorAttributeOptions(ServletWebRequest request
7777

7878
private boolean includeStackTrace(ServletWebRequest request) {
7979
switch (this.errorProperties.getIncludeStacktrace()) {
80-
case ALWAYS:
81-
return true;
82-
case ON_PARAM:
83-
return getBooleanParameter(request, "trace");
84-
default:
85-
return false;
80+
case ALWAYS:
81+
return true;
82+
case ON_PARAM:
83+
return getBooleanParameter(request, "trace");
84+
default:
85+
return false;
8686
}
8787
}
8888

8989
private boolean includeMessage(ServletWebRequest request) {
9090
switch (this.errorProperties.getIncludeMessage()) {
91-
case ALWAYS:
92-
return true;
93-
case ON_PARAM:
94-
return getBooleanParameter(request, "message");
95-
default:
96-
return false;
91+
case ALWAYS:
92+
return true;
93+
case ON_PARAM:
94+
return getBooleanParameter(request, "message");
95+
default:
96+
return false;
9797
}
9898
}
9999

100100
private boolean includeBindingErrors(ServletWebRequest request) {
101101
switch (this.errorProperties.getIncludeBindingErrors()) {
102-
case ALWAYS:
103-
return true;
104-
case ON_PARAM:
105-
return getBooleanParameter(request, "errors");
106-
default:
107-
return false;
102+
case ALWAYS:
103+
return true;
104+
case ON_PARAM:
105+
return getBooleanParameter(request, "errors");
106+
default:
107+
return false;
108108
}
109109
}
110110

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -137,14 +137,14 @@ static class CustomConfigConfiguration {
137137
DynatraceConfig customConfig() {
138138
return (key) -> {
139139
switch (key) {
140-
case "dynatrace.uri":
141-
return "https://dynatrace.example.com";
142-
case "dynatrace.apiToken":
143-
return "abcde";
144-
case "dynatrace.deviceId":
145-
return "test";
146-
default:
147-
return null;
140+
case "dynatrace.uri":
141+
return "https://dynatrace.example.com";
142+
case "dynatrace.apiToken":
143+
return "abcde";
144+
case "dynatrace.deviceId":
145+
return "test";
146+
default:
147+
return null;
148148
}
149149
};
150150
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ private void shutdown(ShutdownOperation shutdownOperation) {
132132
}
133133
this.scheduled.cancel(false);
134134
switch (shutdownOperation) {
135-
case PUSH:
136-
push();
137-
break;
138-
case DELETE:
139-
delete();
140-
break;
135+
case PUSH:
136+
push();
137+
break;
138+
case DELETE:
139+
delete();
140+
break;
141141
}
142142
}
143143

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -266,24 +266,24 @@ private Map<String, Object> sanitizeJobDataMap(JobDataMap dataMap) {
266266

267267
private static TemporalUnit temporalUnit(IntervalUnit unit) {
268268
switch (unit) {
269-
case DAY:
270-
return ChronoUnit.DAYS;
271-
case HOUR:
272-
return ChronoUnit.HOURS;
273-
case MINUTE:
274-
return ChronoUnit.MINUTES;
275-
case MONTH:
276-
return ChronoUnit.MONTHS;
277-
case SECOND:
278-
return ChronoUnit.SECONDS;
279-
case MILLISECOND:
280-
return ChronoUnit.MILLIS;
281-
case WEEK:
282-
return ChronoUnit.WEEKS;
283-
case YEAR:
284-
return ChronoUnit.YEARS;
285-
default:
286-
throw new IllegalArgumentException("Unknown IntervalUnit");
269+
case DAY:
270+
return ChronoUnit.DAYS;
271+
case HOUR:
272+
return ChronoUnit.HOURS;
273+
case MINUTE:
274+
return ChronoUnit.MINUTES;
275+
case MONTH:
276+
return ChronoUnit.MONTHS;
277+
case SECOND:
278+
return ChronoUnit.SECONDS;
279+
case MILLISECOND:
280+
return ChronoUnit.MILLIS;
281+
case WEEK:
282+
return ChronoUnit.WEEKS;
283+
case YEAR:
284+
return ChronoUnit.YEARS;
285+
default:
286+
throw new IllegalArgumentException("Unknown IntervalUnit");
287287
}
288288
}
289289

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceInitializer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public BatchDataSourceInitializer(DataSource dataSource, ResourceLoader resource
4949
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
5050
DatabaseInitializationMode mode = this.jdbcProperties.getInitializeSchema();
5151
switch (mode) {
52-
case ALWAYS:
53-
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
54-
case EMBEDDED:
55-
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
56-
case NEVER:
57-
default:
58-
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
52+
case ALWAYS:
53+
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
54+
case EMBEDDED:
55+
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
56+
case NEVER:
57+
default:
58+
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
5959
}
6060
}
6161

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -100,12 +100,12 @@ public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeM
100100
private ConditionOutcome isWebApplication(ConditionContext context, AnnotatedTypeMetadata metadata,
101101
boolean required) {
102102
switch (deduceType(metadata)) {
103-
case SERVLET:
104-
return isServletWebApplication(context);
105-
case REACTIVE:
106-
return isReactiveWebApplication(context);
107-
default:
108-
return isAnyWebApplication(context, required);
103+
case SERVLET:
104+
return isServletWebApplication(context);
105+
case REACTIVE:
106+
return isReactiveWebApplication(context);
107+
default:
108+
return isAnyWebApplication(context, required);
109109
}
110110
}
111111

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceInitializer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public IntegrationDataSourceInitializer(DataSource dataSource, ResourceLoader re
4747
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
4848
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
4949
switch (mode) {
50-
case ALWAYS:
51-
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
52-
case EMBEDDED:
53-
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
54-
case NEVER:
55-
default:
56-
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
50+
case ALWAYS:
51+
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
52+
case EMBEDDED:
53+
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
54+
case NEVER:
55+
default:
56+
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
5757
}
5858
}
5959

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -305,17 +305,17 @@ private void configureConstructorDetector(Jackson2ObjectMapperBuilder builder) {
305305
if (strategy != null) {
306306
builder.postConfigurer((objectMapper) -> {
307307
switch (strategy) {
308-
case USE_PROPERTIES_BASED:
309-
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
310-
break;
311-
case USE_DELEGATING:
312-
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
313-
break;
314-
case EXPLICIT_ONLY:
315-
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
316-
break;
317-
default:
318-
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
308+
case USE_PROPERTIES_BASED:
309+
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
310+
break;
311+
case USE_DELEGATING:
312+
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
313+
break;
314+
case EXPLICIT_ONLY:
315+
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
316+
break;
317+
default:
318+
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
319319
}
320320
});
321321
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,14 +80,14 @@ private static List<String> scriptLocations(List<String> locations, String fallb
8080

8181
private static DatabaseInitializationMode mapMode(org.springframework.boot.jdbc.DataSourceInitializationMode mode) {
8282
switch (mode) {
83-
case ALWAYS:
84-
return DatabaseInitializationMode.ALWAYS;
85-
case EMBEDDED:
86-
return DatabaseInitializationMode.EMBEDDED;
87-
case NEVER:
88-
return DatabaseInitializationMode.NEVER;
89-
default:
90-
throw new IllegalStateException("Unexpected initialization mode '" + mode + "'");
83+
case ALWAYS:
84+
return DatabaseInitializationMode.ALWAYS;
85+
case EMBEDDED:
86+
return DatabaseInitializationMode.EMBEDDED;
87+
case NEVER:
88+
return DatabaseInitializationMode.NEVER;
89+
default:
90+
throw new IllegalStateException("Unexpected initialization mode '" + mode + "'");
9191
}
9292
}
9393

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -188,19 +188,20 @@ private Config.TrustStrategy mapTrustStrategy(Neo4jProperties.Security securityP
188188
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
189189
Security.TrustStrategy strategy) {
190190
switch (strategy) {
191-
case TRUST_ALL_CERTIFICATES:
192-
return TrustStrategy.trustAllCertificates();
193-
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
194-
return TrustStrategy.trustSystemCertificates();
195-
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
196-
File certFile = securityProperties.getCertFile();
197-
if (certFile == null || !certFile.isFile()) {
191+
case TRUST_ALL_CERTIFICATES:
192+
return TrustStrategy.trustAllCertificates();
193+
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
194+
return TrustStrategy.trustSystemCertificates();
195+
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
196+
File certFile = securityProperties.getCertFile();
197+
if (certFile == null || !certFile.isFile()) {
198+
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
199+
"Configured trust strategy requires a certificate file.");
200+
}
201+
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
202+
default:
198203
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
199-
"Configured trust strategy requires a certificate file.");
200-
}
201-
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
202-
default:
203-
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), "Unknown strategy.");
204+
"Unknown strategy.");
204205
}
205206
}
206207

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzDataSourceInitializer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ protected void customize(ResourceDatabasePopulator populator) {
5353
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
5454
DatabaseInitializationMode mode = this.properties.getJdbc().getInitializeSchema();
5555
switch (mode) {
56-
case ALWAYS:
57-
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
58-
case EMBEDDED:
59-
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
60-
case NEVER:
61-
default:
62-
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
56+
case ALWAYS:
57+
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
58+
case EMBEDDED:
59+
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
60+
case NEVER:
61+
default:
62+
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
6363
}
6464
}
6565

0 commit comments

Comments
 (0)