diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index f09112a67b..9c37269cc2 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 1992f814e3..d1230f2c3d 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 2050b1b52a..eb56899e8a 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 dfd6dc6ffc..317b784d67 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 @@ -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. @@ -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 e02182783e..813437f34b 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 @@ -132,12 +132,12 @@ public class PrometheusPushGatewayManager { } this.scheduled.cancel(false); switch (shutdownOperation) { - case PUSH: - push(); - break; - case DELETE: - delete(); - break; + case PUSH: + push(); + 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 01e677a5e1..a6ece7f386 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/batch/BatchDataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceInitializer.java index 8f1b5c1d58..38c8dd7ce4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceInitializer.java @@ -49,13 +49,13 @@ public class BatchDataSourceInitializer extends org.springframework.boot.jdbc.Ab protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() { DatabaseInitializationMode mode = this.jdbcProperties.getInitializeSchema(); switch (mode) { - case ALWAYS: - return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; - case EMBEDDED: - return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; - case NEVER: - default: - return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; + case ALWAYS: + return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; + case EMBEDDED: + return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; + case NEVER: + default: + return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; } } 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 f054557698..46018d5f79 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/integration/IntegrationDataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceInitializer.java index a6f09f6f44..9a006569e3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceInitializer.java @@ -47,13 +47,13 @@ public class IntegrationDataSourceInitializer extends org.springframework.boot.j protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() { DatabaseInitializationMode mode = this.properties.getInitializeSchema(); switch (mode) { - case ALWAYS: - return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; - case EMBEDDED: - return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; - case NEVER: - default: - return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; + case ALWAYS: + return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; + case EMBEDDED: + return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; + case NEVER: + default: + return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; } } 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 90b035efe9..12b0203e97 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 e92277f542..39c52b4d30 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/quartz/QuartzDataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzDataSourceInitializer.java index 728c519246..c1ca183c8c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzDataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzDataSourceInitializer.java @@ -53,13 +53,13 @@ public class QuartzDataSourceInitializer extends org.springframework.boot.jdbc.A protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() { DatabaseInitializationMode mode = this.properties.getJdbc().getInitializeSchema(); switch (mode) { - case ALWAYS: - return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; - case EMBEDDED: - return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; - case NEVER: - default: - return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; + case ALWAYS: + return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; + case EMBEDDED: + return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; + case NEVER: + default: + return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceInitializer.java index 6f2eb6ee38..6101c8f0f9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceInitializer.java @@ -47,13 +47,13 @@ public class JdbcSessionDataSourceInitializer extends org.springframework.boot.j protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() { DatabaseInitializationMode mode = this.properties.getInitializeSchema(); switch (mode) { - case ALWAYS: - return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; - case EMBEDDED: - return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; - case NEVER: - default: - return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; + case ALWAYS: + return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS; + case EMBEDDED: + return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED; + case NEVER: + default: + return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER; } } 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 e31c794c85..3b9fb921b8 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 @@ -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. @@ -56,10 +56,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/session/SessionStoreMappings.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java index d1412f385e..f9253b9012 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.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. @@ -77,10 +77,10 @@ final class SessionStoreMappings { String getConfiguration(WebApplicationType webApplicationType) { switch (webApplicationType) { - case SERVLET: - return getName(this.servletConfiguration); - case REACTIVE: - return getName(this.reactiveConfiguration); + case SERVLET: + return getName(this.servletConfiguration); + case REACTIVE: + return getName(this.reactiveConfiguration); } return null; } 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 01c4da841d..4ea6aa4f27 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. @@ -173,12 +173,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; } } @@ -190,12 +190,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; } } @@ -207,12 +207,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 d9d0bb052a..5949e37dc8 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 db7127eec2..cfec6d3970 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 5bcd246886..f2e2e85630 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 740b159a77..87f1dd473a 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 c3d73a970a..8292d1aa5e 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 '\t': - this.out.append("\\t"); - break; - - case '\b': - this.out.append("\\b"); - break; - - case '\n': - this.out.append("\\n"); - break; - - case '\r': - this.out.append("\\r"); - 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; + case '"': + case '\\': + case '/': + this.out.append('\\').append(c); + break; + + case '\t': + this.out.append("\\t"); + break; + + case '\b': + this.out.append("\\b"); + break; + + case '\n': + this.out.append("\\n"); + break; + + case '\r': + this.out.append("\\r"); + 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; } } 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 2a47e73e94..d9f12984bf 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 '\t': + case ' ': + case '\n': + case '\r': + continue; - case '/': - if (this.pos == this.in.length()) { - return c; - } + 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"); + 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; } - this.pos = commentEnd + 2; - continue; - case '/': - // skip a // end-of-line comment - this.pos++; + 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/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 0527c8d9de..bcb9bdde04 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 @@ -356,12 +356,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; } } @@ -457,12 +457,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 81b440ec65..622fd781eb 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 @@ -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. @@ -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 f6d730a366..49db3fced6 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 @@ -717,12 +717,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 d1e43c6e20..449b0cafb1 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-jetty10/src/main/java/smoketest/websocket/jetty10/snake/Location.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/Location.java index 8121a754ad..6510b6611e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/Location.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/Location.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. @@ -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 1b8ff1bff1..60d76708b5 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 ae6999b8a6..6a812a6331 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; } }