diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index f09112a67b9..9c37269cc2e 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -1 +1 @@ -javaFormatVersion=0.0.33 +javaFormatVersion=0.0.34 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroup.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroup.java index 1992f814e3c..d1230f2c3d6 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroup.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -96,12 +96,12 @@ class AutoConfiguredHealthEndpointGroup implements HealthEndpointGroup { private boolean getShowResult(SecurityContext securityContext, Show show) { switch (show) { - case NEVER: - return false; - case ALWAYS: - return true; - case WHEN_AUTHORIZED: - return isAuthorized(securityContext); + case NEVER: + return false; + case ALWAYS: + return true; + case WHEN_AUTHORIZED: + return isAuthorized(securityContext); } throw new IllegalStateException("Unsupported 'show' value " + show); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpoint.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpoint.java index 2050b1b52a8..eb56899e8a3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpoint.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. @@ -77,34 +77,34 @@ public class ManagementErrorEndpoint { private boolean includeStackTrace(ServletWebRequest request) { switch (this.errorProperties.getIncludeStacktrace()) { - case ALWAYS: - return true; - case ON_PARAM: - return getBooleanParameter(request, "trace"); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getBooleanParameter(request, "trace"); + default: + return false; } } private boolean includeMessage(ServletWebRequest request) { switch (this.errorProperties.getIncludeMessage()) { - case ALWAYS: - return true; - case ON_PARAM: - return getBooleanParameter(request, "message"); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getBooleanParameter(request, "message"); + default: + return false; } } private boolean includeBindingErrors(ServletWebRequest request) { switch (this.errorProperties.getIncludeBindingErrors()) { - case ALWAYS: - return true; - case ON_PARAM: - return getBooleanParameter(request, "errors"); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getBooleanParameter(request, "errors"); + default: + return false; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java index 7b24f2857f9..3f6b2beae4e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java @@ -137,14 +137,14 @@ class DynatraceMetricsExportAutoConfigurationTests { DynatraceConfig customConfig() { return (key) -> { switch (key) { - case "dynatrace.uri": - return "https://dynatrace.example.com"; - case "dynatrace.apiToken": - return "abcde"; - case "dynatrace.deviceId": - return "test"; - default: - return null; + case "dynatrace.uri": + return "https://dynatrace.example.com"; + case "dynatrace.apiToken": + return "abcde"; + case "dynatrace.deviceId": + return "test"; + default: + return null; } }; } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java index 6d150d44a4f..91639aff560 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManager.java @@ -141,16 +141,16 @@ public class PrometheusPushGatewayManager { } this.scheduled.cancel(false); switch (shutdownOperation) { - case PUSH: - case POST: - post(); - break; - case PUT: - put(); - break; - case DELETE: - delete(); - break; + case PUSH: + case POST: + post(); + break; + case PUT: + put(); + break; + case DELETE: + delete(); + break; } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java index 01e677a5e1f..a6ece7f386b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -266,24 +266,24 @@ public class QuartzEndpoint { private static TemporalUnit temporalUnit(IntervalUnit unit) { switch (unit) { - case DAY: - return ChronoUnit.DAYS; - case HOUR: - return ChronoUnit.HOURS; - case MINUTE: - return ChronoUnit.MINUTES; - case MONTH: - return ChronoUnit.MONTHS; - case SECOND: - return ChronoUnit.SECONDS; - case MILLISECOND: - return ChronoUnit.MILLIS; - case WEEK: - return ChronoUnit.WEEKS; - case YEAR: - return ChronoUnit.YEARS; - default: - throw new IllegalArgumentException("Unknown IntervalUnit"); + case DAY: + return ChronoUnit.DAYS; + case HOUR: + return ChronoUnit.HOURS; + case MINUTE: + return ChronoUnit.MINUTES; + case MONTH: + return ChronoUnit.MONTHS; + case SECOND: + return ChronoUnit.SECONDS; + case MILLISECOND: + return ChronoUnit.MILLIS; + case WEEK: + return ChronoUnit.WEEKS; + case YEAR: + return ChronoUnit.YEARS; + default: + throw new IllegalArgumentException("Unknown IntervalUnit"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java index f0545576986..46018d5f79e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -100,12 +100,12 @@ class OnWebApplicationCondition extends FilteringSpringBootCondition { private ConditionOutcome isWebApplication(ConditionContext context, AnnotatedTypeMetadata metadata, boolean required) { switch (deduceType(metadata)) { - case SERVLET: - return isServletWebApplication(context); - case REACTIVE: - return isReactiveWebApplication(context); - default: - return isAnyWebApplication(context, required); + case SERVLET: + return isServletWebApplication(context); + case REACTIVE: + return isReactiveWebApplication(context); + default: + return isAnyWebApplication(context, required); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java index 90b035efe9d..12b0203e974 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java @@ -315,17 +315,17 @@ public class JacksonAutoConfiguration { if (strategy != null) { builder.postConfigurer((objectMapper) -> { switch (strategy) { - case USE_PROPERTIES_BASED: - objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED); - break; - case USE_DELEGATING: - objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING); - break; - case EXPLICIT_ONLY: - objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY); - break; - default: - objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT); + case USE_PROPERTIES_BASED: + objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED); + break; + case USE_DELEGATING: + objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING); + break; + case EXPLICIT_ONLY: + objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY); + break; + default: + objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT); } }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java index e92277f5421..39c52b4d306 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java @@ -188,19 +188,20 @@ public class Neo4jAutoConfiguration { private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName, Security.TrustStrategy strategy) { switch (strategy) { - case TRUST_ALL_CERTIFICATES: - return TrustStrategy.trustAllCertificates(); - case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: - return TrustStrategy.trustSystemCertificates(); - case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: - File certFile = securityProperties.getCertFile(); - if (certFile == null || !certFile.isFile()) { + case TRUST_ALL_CERTIFICATES: + return TrustStrategy.trustAllCertificates(); + case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: + return TrustStrategy.trustSystemCertificates(); + case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: + File certFile = securityProperties.getCertFile(); + if (certFile == null || !certFile.isFile()) { + throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), + "Configured trust strategy requires a certificate file."); + } + return TrustStrategy.trustCustomCertificateSignedBy(certFile); + default: throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), - "Configured trust strategy requires a certificate file."); - } - return TrustStrategy.trustCustomCertificateSignedBy(certFile); - default: - throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), "Unknown strategy."); + "Unknown strategy."); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java index 04dfbd47a0d..6f8f371fc99 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java @@ -54,10 +54,10 @@ class RedisSessionConfiguration { @ConditionalOnMissingBean ConfigureRedisAction configureRedisAction(RedisSessionProperties redisSessionProperties) { switch (redisSessionProperties.getConfigureAction()) { - case NOTIFY_KEYSPACE_EVENTS: - return new ConfigureNotifyKeyspaceEventsAction(); - case NONE: - return ConfigureRedisAction.NO_OP; + case NOTIFY_KEYSPACE_EVENTS: + return new ConfigureNotifyKeyspaceEventsAction(); + case NONE: + return ConfigureRedisAction.NO_OP; } throw new IllegalStateException( "Unsupported redis configure action '" + redisSessionProperties.getConfigureAction() + "'."); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java index 9fd92b851f9..a26710377e8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -174,12 +174,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa */ protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) { switch (this.errorProperties.getIncludeStacktrace()) { - case ALWAYS: - return true; - case ON_PARAM: - return isTraceEnabled(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return isTraceEnabled(request); + default: + return false; } } @@ -191,12 +191,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa */ protected boolean isIncludeMessage(ServerRequest request, MediaType produces) { switch (this.errorProperties.getIncludeMessage()) { - case ALWAYS: - return true; - case ON_PARAM: - return isMessageEnabled(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return isMessageEnabled(request); + default: + return false; } } @@ -208,12 +208,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa */ protected boolean isIncludeBindingErrors(ServerRequest request, MediaType produces) { switch (this.errorProperties.getIncludeBindingErrors()) { - case ALWAYS: - return true; - case ON_PARAM: - return isBindingErrorsEnabled(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return isBindingErrorsEnabled(request); + default: + return false; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index 27d6bf9dbd1..ce22ed22150 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -132,12 +132,12 @@ public class BasicErrorController extends AbstractErrorController { */ protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) { switch (getErrorProperties().getIncludeStacktrace()) { - case ALWAYS: - return true; - case ON_PARAM: - return getTraceParameter(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getTraceParameter(request); + default: + return false; } } @@ -149,12 +149,12 @@ public class BasicErrorController extends AbstractErrorController { */ protected boolean isIncludeMessage(HttpServletRequest request, MediaType produces) { switch (getErrorProperties().getIncludeMessage()) { - case ALWAYS: - return true; - case ON_PARAM: - return getMessageParameter(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getMessageParameter(request); + default: + return false; } } @@ -166,12 +166,12 @@ public class BasicErrorController extends AbstractErrorController { */ protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) { switch (getErrorProperties().getIncludeBindingErrors()) { - case ALWAYS: - return true; - case ON_PARAM: - return getErrorsParameter(request); - default: - return false; + case ALWAYS: + return true; + case ON_PARAM: + return getErrorsParameter(request); + default: + return false; } } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java index db7127eec29..cfec6d39700 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -27,12 +27,12 @@ public class MyReadinessStateExporter { @EventListener public void onStateChange(AvailabilityChangeEvent event) { switch (event.getState()) { - case ACCEPTING_TRAFFIC: - // create file /tmp/healthy - break; - case REFUSING_TRAFFIC: - // remove file /tmp/healthy - break; + case ACCEPTING_TRAFFIC: + // create file /tmp/healthy + break; + case REFUSING_TRAFFIC: + // remove file /tmp/healthy + break; } } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java index 5bcd2468869..f2e2e856305 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -70,26 +70,26 @@ public class FilterAnnotations implements Iterable { @SuppressWarnings("unchecked") private TypeFilter createTypeFilter(FilterType filterType, Class filterClass) { switch (filterType) { - case ANNOTATION: - Assert.isAssignable(Annotation.class, filterClass, - "An error occurred while processing an ANNOTATION type filter: "); - return new AnnotationTypeFilter((Class) filterClass); - case ASSIGNABLE_TYPE: - return new AssignableTypeFilter(filterClass); - case CUSTOM: - Assert.isAssignable(TypeFilter.class, filterClass, - "An error occurred while processing a CUSTOM type filter: "); - return BeanUtils.instantiateClass(filterClass, TypeFilter.class); + case ANNOTATION: + Assert.isAssignable(Annotation.class, filterClass, + "An error occurred while processing an ANNOTATION type filter: "); + return new AnnotationTypeFilter((Class) filterClass); + case ASSIGNABLE_TYPE: + return new AssignableTypeFilter(filterClass); + case CUSTOM: + Assert.isAssignable(TypeFilter.class, filterClass, + "An error occurred while processing a CUSTOM type filter: "); + return BeanUtils.instantiateClass(filterClass, TypeFilter.class); } throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType); } private TypeFilter createTypeFilter(FilterType filterType, String pattern) { switch (filterType) { - case ASPECTJ: - return new AspectJTypeFilter(pattern, this.classLoader); - case REGEX: - return new RegexPatternTypeFilter(Pattern.compile(pattern)); + case ASPECTJ: + return new AspectJTypeFilter(pattern, this.classLoader); + case REGEX: + return new RegexPatternTypeFilter(Pattern.compile(pattern)); } throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/LogUpdateEvent.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/LogUpdateEvent.java index 740b159a774..87f1dd473a4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/LogUpdateEvent.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/LogUpdateEvent.java @@ -54,12 +54,12 @@ public class LogUpdateEvent extends UpdateEvent { public void print() { switch (this.streamType) { - case STD_OUT: - System.out.println(this); - return; - case STD_ERR: - System.err.println(this); - return; + case STD_OUT: + System.out.println(this); + return; + case STD_ERR: + System.err.println(this); + return; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java index c3d73a970ac..8292d1aa5ec 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java @@ -321,40 +321,40 @@ public class JSONStringer { * reverse solidus, and the control characters (U+0000 through U+001F)." */ switch (c) { - case '"': - case '\\': - case '/': - this.out.append('\\').append(c); - break; + case '"': + case '\\': + case '/': + this.out.append('\\').append(c); + break; - case '\t': - this.out.append("\\t"); - break; + case '\t': + this.out.append("\\t"); + break; - case '\b': - this.out.append("\\b"); - break; + case '\b': + this.out.append("\\b"); + break; - case '\n': - this.out.append("\\n"); - break; + case '\n': + this.out.append("\\n"); + break; - case '\r': - this.out.append("\\r"); - break; + case '\r': + this.out.append("\\r"); + break; - case '\f': - this.out.append("\\f"); - break; + case '\f': + this.out.append("\\f"); + break; - default: - if (c <= 0x1F) { - this.out.append(String.format("\\u%04x", (int) c)); - } - else { - this.out.append(c); - } - break; + default: + if (c <= 0x1F) { + this.out.append(String.format("\\u%04x", (int) c)); + } + else { + this.out.append(c); + } + break; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java index 2a47e73e94a..d9f12984bf4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java @@ -91,22 +91,22 @@ public class JSONTokener { public Object nextValue() throws JSONException { int c = nextCleanInternal(); switch (c) { - case -1: - throw syntaxError("End of input"); + case -1: + throw syntaxError("End of input"); - case '{': - return readObject(); + case '{': + return readObject(); - case '[': - return readArray(); + case '[': + return readArray(); - case '\'': - case '"': - return nextString((char) c); + case '\'': + case '"': + return nextString((char) c); - default: - this.pos--; - return readLiteral(); + default: + this.pos--; + return readLiteral(); } } @@ -114,50 +114,50 @@ public class JSONTokener { while (this.pos < this.in.length()) { int c = this.in.charAt(this.pos++); switch (c) { - case '\t': - case ' ': - case '\n': - case '\r': - continue; - - case '/': - if (this.pos == this.in.length()) { - return c; - } - - char peek = this.in.charAt(this.pos); - switch (peek) { - case '*': - // skip a /* c-style comment */ - this.pos++; - int commentEnd = this.in.indexOf("*/", this.pos); - if (commentEnd == -1) { - throw syntaxError("Unterminated comment"); - } - this.pos = commentEnd + 2; + case '\t': + case ' ': + case '\n': + case '\r': continue; case '/': - // skip a // end-of-line comment - this.pos++; + if (this.pos == this.in.length()) { + return c; + } + + char peek = this.in.charAt(this.pos); + switch (peek) { + case '*': + // skip a /* c-style comment */ + this.pos++; + int commentEnd = this.in.indexOf("*/", this.pos); + if (commentEnd == -1) { + throw syntaxError("Unterminated comment"); + } + this.pos = commentEnd + 2; + continue; + + case '/': + // skip a // end-of-line comment + this.pos++; + skipToEndOfLine(); + continue; + + default: + return c; + } + + case '#': + /* + * Skip a # hash end-of-line comment. The JSON RFC doesn't specify + * this behavior, but it's required to parse existing documents. See + * https://b/2571423. + */ skipToEndOfLine(); continue; default: return c; - } - - case '#': - /* - * Skip a # hash end-of-line comment. The JSON RFC doesn't specify this - * behavior, but it's required to parse existing documents. See - * https://b/2571423. - */ - skipToEndOfLine(); - continue; - - default: - return c; } } @@ -239,34 +239,34 @@ public class JSONTokener { private char readEscapeCharacter() throws JSONException { char escaped = this.in.charAt(this.pos++); switch (escaped) { - case 'u': - if (this.pos + 4 > this.in.length()) { - throw syntaxError("Unterminated escape sequence"); - } - String hex = this.in.substring(this.pos, this.pos + 4); - this.pos += 4; - return (char) Integer.parseInt(hex, 16); + case 'u': + if (this.pos + 4 > this.in.length()) { + throw syntaxError("Unterminated escape sequence"); + } + String hex = this.in.substring(this.pos, this.pos + 4); + this.pos += 4; + return (char) Integer.parseInt(hex, 16); - case 't': - return '\t'; + case 't': + return '\t'; - case 'b': - return '\b'; + case 'b': + return '\b'; - case 'n': - return '\n'; + case 'n': + return '\n'; - case 'r': - return '\r'; + case 'r': + return '\r'; - case 'f': - return '\f'; + case 'f': + return '\f'; - case '\'': - case '"': - case '\\': - default: - return escaped; + case '\'': + case '"': + case '\\': + default: + return escaped; } } @@ -396,13 +396,13 @@ public class JSONTokener { result.put((String) name, nextValue()); switch (nextCleanInternal()) { - case '}': - return result; - case ';': - case ',': - continue; - default: - throw syntaxError("Unterminated object"); + case '}': + return result; + case ';': + case ',': + continue; + default: + throw syntaxError("Unterminated object"); } } } @@ -422,34 +422,34 @@ public class JSONTokener { while (true) { switch (nextCleanInternal()) { - case -1: - throw syntaxError("Unterminated array"); - case ']': - if (hasTrailingSeparator) { + case -1: + throw syntaxError("Unterminated array"); + case ']': + if (hasTrailingSeparator) { + result.put(null); + } + return result; + case ',': + case ';': + /* A separator without a value first means "null". */ result.put(null); - } - return result; - case ',': - case ';': - /* A separator without a value first means "null". */ - result.put(null); - hasTrailingSeparator = true; - continue; - default: - this.pos--; + hasTrailingSeparator = true; + continue; + default: + this.pos--; } result.put(nextValue()); switch (nextCleanInternal()) { - case ']': - return result; - case ',': - case ';': - hasTrailingSeparator = true; - continue; - default: - throw syntaxError("Unterminated array"); + case ']': + return result; + case ',': + case ';': + hasTrailingSeparator = true; + continue; + default: + throw syntaxError("Unterminated array"); } } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java index 11757bb3736..01a56fa3fe2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotProcessor.java @@ -168,12 +168,12 @@ public class AotProcessor { private Path getRoot(Kind kind) { switch (kind) { - case SOURCE: - return this.sourceOutput; - case RESOURCE: - return this.resourceOutput; - case CLASS: - return this.classOutput; + case SOURCE: + return this.sourceOutput; + case RESOURCE: + return this.resourceOutput; + case CLASS: + return this.classOutput; } throw new IllegalStateException("Unsupported kind " + kind); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 79875caf500..5d332e584c5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -363,12 +363,12 @@ public class SpringApplication { private Class deduceEnvironmentClass() { switch (this.webApplicationType) { - case SERVLET: - return ApplicationServletEnvironment.class; - case REACTIVE: - return ApplicationReactiveWebEnvironment.class; - default: - return ApplicationEnvironment.class; + case SERVLET: + return ApplicationServletEnvironment.class; + case REACTIVE: + return ApplicationReactiveWebEnvironment.class; + default: + return ApplicationEnvironment.class; } } @@ -458,12 +458,12 @@ public class SpringApplication { return this.environment; } switch (this.webApplicationType) { - case SERVLET: - return new ApplicationServletEnvironment(); - case REACTIVE: - return new ApplicationReactiveWebEnvironment(); - default: - return new ApplicationEnvironment(); + case SERVLET: + return new ApplicationServletEnvironment(); + case REACTIVE: + return new ApplicationReactiveWebEnvironment(); + default: + return new ApplicationEnvironment(); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java index 05795a5203d..0a8b3dc215f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java @@ -245,23 +245,23 @@ public class DeferredLog implements Log { static void logTo(Log log, LogLevel level, Object message, Throwable throwable) { switch (level) { - case TRACE: - log.trace(message, throwable); - return; - case DEBUG: - log.debug(message, throwable); - return; - case INFO: - log.info(message, throwable); - return; - case WARN: - log.warn(message, throwable); - return; - case ERROR: - log.error(message, throwable); - return; - case FATAL: - log.fatal(message, throwable); + case TRACE: + log.trace(message, throwable); + return; + case DEBUG: + log.debug(message, throwable); + return; + case INFO: + log.info(message, throwable); + return; + case WARN: + log.warn(message, throwable); + return; + case ERROR: + log.error(message, throwable); + return; + case FATAL: + log.fatal(message, throwable); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java index 4d856b9b11c..121af13aa12 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java @@ -705,12 +705,12 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor private String getSameSiteComment(SameSite sameSite) { switch (sameSite) { - case NONE: - return HttpCookie.SAME_SITE_NONE_COMMENT; - case LAX: - return HttpCookie.SAME_SITE_LAX_COMMENT; - case STRICT: - return HttpCookie.SAME_SITE_STRICT_COMMENT; + case NONE: + return HttpCookie.SAME_SITE_NONE_COMMENT; + case LAX: + return HttpCookie.SAME_SITE_LAX_COMMENT; + case STRICT: + return HttpCookie.SAME_SITE_STRICT_COMMENT; } throw new IllegalStateException("Unsupported SameSite value " + sameSite); } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/Location.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/Location.java index d1e43c6e201..449b0cafb1a 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/Location.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/Location.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -35,18 +35,18 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { - case NORTH: - return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); - case SOUTH: - return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); - case EAST: - return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); - case WEST: - return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); - case NONE: - // fall through - default: - return this; + case NORTH: + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); + case SOUTH: + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); + case EAST: + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); + case WEST: + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); + case NONE: + // fall through + default: + return this; } } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/Location.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/Location.java index 1b8ff1bff1b..60d76708b5a 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/Location.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/Location.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -35,18 +35,18 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { - case NORTH: - return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); - case SOUTH: - return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); - case EAST: - return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); - case WEST: - return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); - case NONE: - // fall through - default: - return this; + case NORTH: + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); + case SOUTH: + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); + case EAST: + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); + case WEST: + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); + case NONE: + // fall through + default: + return this; } } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/Location.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/Location.java index ae6999b8a67..6a812a6331c 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/Location.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/Location.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -35,18 +35,18 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { - case NORTH: - return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); - case SOUTH: - return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); - case EAST: - return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); - case WEST: - return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); - case NONE: - // fall through - default: - return this; + case NORTH: + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); + case SOUTH: + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); + case EAST: + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); + case WEST: + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); + case NONE: + // fall through + default: + return this; } }