Merge branch '2.6.x' into 2.7.x

Closes gh-31525
pull/31660/head
Andy Wilkinson 2 years ago
commit 1e08f545d0

@ -1 +1 @@
javaFormatVersion=0.0.33
javaFormatVersion=0.0.34

@ -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);
}

@ -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;
}
}

@ -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;
}
};
}

@ -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;
}
}

@ -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");
}
}

@ -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;
}
}

@ -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);
}
}

@ -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;
}
}

@ -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);
}
});
}

@ -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.");
}
}

@ -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;
}
}

@ -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;
}
}

@ -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() + "'.");

@ -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;
}

@ -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;
}
}

@ -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;
}
}

@ -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<ReadinessState> 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;
}
}

@ -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<TypeFilter> {
@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<Annotation>) 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<Annotation>) 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);
}

@ -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;
}
}

@ -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;
}
}

@ -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");
}
}
}

@ -356,12 +356,12 @@ public class SpringApplication {
private Class<? extends StandardEnvironment> 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();
}
}

@ -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);
}
}

@ -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);
}

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

Loading…
Cancel
Save