mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.6.x' into 2.7.x
Closes gh-31525
This commit is contained in:
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
private boolean getShowResult(SecurityContext securityContext, Show show) {
|
||||||
switch (show) {
|
switch (show) {
|
||||||
case NEVER:
|
case NEVER:
|
||||||
return false;
|
return false;
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case WHEN_AUTHORIZED:
|
case WHEN_AUTHORIZED:
|
||||||
return isAuthorized(securityContext);
|
return isAuthorized(securityContext);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Unsupported 'show' value " + show);
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
private boolean includeStackTrace(ServletWebRequest request) {
|
||||||
switch (this.errorProperties.getIncludeStacktrace()) {
|
switch (this.errorProperties.getIncludeStacktrace()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getBooleanParameter(request, "trace");
|
return getBooleanParameter(request, "trace");
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean includeMessage(ServletWebRequest request) {
|
private boolean includeMessage(ServletWebRequest request) {
|
||||||
switch (this.errorProperties.getIncludeMessage()) {
|
switch (this.errorProperties.getIncludeMessage()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getBooleanParameter(request, "message");
|
return getBooleanParameter(request, "message");
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean includeBindingErrors(ServletWebRequest request) {
|
private boolean includeBindingErrors(ServletWebRequest request) {
|
||||||
switch (this.errorProperties.getIncludeBindingErrors()) {
|
switch (this.errorProperties.getIncludeBindingErrors()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getBooleanParameter(request, "errors");
|
return getBooleanParameter(request, "errors");
|
||||||
default:
|
default:
|
||||||
return false;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -137,14 +137,14 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
|||||||
DynatraceConfig customConfig() {
|
DynatraceConfig customConfig() {
|
||||||
return (key) -> {
|
return (key) -> {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "dynatrace.uri":
|
case "dynatrace.uri":
|
||||||
return "https://dynatrace.example.com";
|
return "https://dynatrace.example.com";
|
||||||
case "dynatrace.apiToken":
|
case "dynatrace.apiToken":
|
||||||
return "abcde";
|
return "abcde";
|
||||||
case "dynatrace.deviceId":
|
case "dynatrace.deviceId":
|
||||||
return "test";
|
return "test";
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -132,12 +132,12 @@ public class PrometheusPushGatewayManager {
|
|||||||
}
|
}
|
||||||
this.scheduled.cancel(false);
|
this.scheduled.cancel(false);
|
||||||
switch (shutdownOperation) {
|
switch (shutdownOperation) {
|
||||||
case PUSH:
|
case PUSH:
|
||||||
push();
|
push();
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
delete();
|
delete();
|
||||||
break;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
private static TemporalUnit temporalUnit(IntervalUnit unit) {
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case DAY:
|
case DAY:
|
||||||
return ChronoUnit.DAYS;
|
return ChronoUnit.DAYS;
|
||||||
case HOUR:
|
case HOUR:
|
||||||
return ChronoUnit.HOURS;
|
return ChronoUnit.HOURS;
|
||||||
case MINUTE:
|
case MINUTE:
|
||||||
return ChronoUnit.MINUTES;
|
return ChronoUnit.MINUTES;
|
||||||
case MONTH:
|
case MONTH:
|
||||||
return ChronoUnit.MONTHS;
|
return ChronoUnit.MONTHS;
|
||||||
case SECOND:
|
case SECOND:
|
||||||
return ChronoUnit.SECONDS;
|
return ChronoUnit.SECONDS;
|
||||||
case MILLISECOND:
|
case MILLISECOND:
|
||||||
return ChronoUnit.MILLIS;
|
return ChronoUnit.MILLIS;
|
||||||
case WEEK:
|
case WEEK:
|
||||||
return ChronoUnit.WEEKS;
|
return ChronoUnit.WEEKS;
|
||||||
case YEAR:
|
case YEAR:
|
||||||
return ChronoUnit.YEARS;
|
return ChronoUnit.YEARS;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unknown IntervalUnit");
|
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() {
|
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
||||||
DatabaseInitializationMode mode = this.jdbcProperties.getInitializeSchema();
|
DatabaseInitializationMode mode = this.jdbcProperties.getInitializeSchema();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
||||||
case EMBEDDED:
|
case EMBEDDED:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
||||||
case NEVER:
|
case NEVER:
|
||||||
default:
|
default:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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,
|
private ConditionOutcome isWebApplication(ConditionContext context, AnnotatedTypeMetadata metadata,
|
||||||
boolean required) {
|
boolean required) {
|
||||||
switch (deduceType(metadata)) {
|
switch (deduceType(metadata)) {
|
||||||
case SERVLET:
|
case SERVLET:
|
||||||
return isServletWebApplication(context);
|
return isServletWebApplication(context);
|
||||||
case REACTIVE:
|
case REACTIVE:
|
||||||
return isReactiveWebApplication(context);
|
return isReactiveWebApplication(context);
|
||||||
default:
|
default:
|
||||||
return isAnyWebApplication(context, required);
|
return isAnyWebApplication(context, required);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ public class IntegrationDataSourceInitializer extends org.springframework.boot.j
|
|||||||
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
||||||
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
|
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
||||||
case EMBEDDED:
|
case EMBEDDED:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
||||||
case NEVER:
|
case NEVER:
|
||||||
default:
|
default:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,17 +315,17 @@ public class JacksonAutoConfiguration {
|
|||||||
if (strategy != null) {
|
if (strategy != null) {
|
||||||
builder.postConfigurer((objectMapper) -> {
|
builder.postConfigurer((objectMapper) -> {
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case USE_PROPERTIES_BASED:
|
case USE_PROPERTIES_BASED:
|
||||||
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
|
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
|
||||||
break;
|
break;
|
||||||
case USE_DELEGATING:
|
case USE_DELEGATING:
|
||||||
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
|
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
|
||||||
break;
|
break;
|
||||||
case EXPLICIT_ONLY:
|
case EXPLICIT_ONLY:
|
||||||
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
|
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
|
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -188,19 +188,20 @@ public class Neo4jAutoConfiguration {
|
|||||||
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
|
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
|
||||||
Security.TrustStrategy strategy) {
|
Security.TrustStrategy strategy) {
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case TRUST_ALL_CERTIFICATES:
|
case TRUST_ALL_CERTIFICATES:
|
||||||
return TrustStrategy.trustAllCertificates();
|
return TrustStrategy.trustAllCertificates();
|
||||||
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
|
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
|
||||||
return TrustStrategy.trustSystemCertificates();
|
return TrustStrategy.trustSystemCertificates();
|
||||||
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
|
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
|
||||||
File certFile = securityProperties.getCertFile();
|
File certFile = securityProperties.getCertFile();
|
||||||
if (certFile == null || !certFile.isFile()) {
|
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(),
|
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
|
||||||
"Configured trust strategy requires a certificate file.");
|
"Unknown strategy.");
|
||||||
}
|
|
||||||
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
|
|
||||||
default:
|
|
||||||
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), "Unknown strategy.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ public class QuartzDataSourceInitializer extends org.springframework.boot.jdbc.A
|
|||||||
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
||||||
DatabaseInitializationMode mode = this.properties.getJdbc().getInitializeSchema();
|
DatabaseInitializationMode mode = this.properties.getJdbc().getInitializeSchema();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
||||||
case EMBEDDED:
|
case EMBEDDED:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
||||||
case NEVER:
|
case NEVER:
|
||||||
default:
|
default:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
|
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() {
|
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
|
||||||
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
|
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
|
||||||
case EMBEDDED:
|
case EMBEDDED:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
|
||||||
case NEVER:
|
case NEVER:
|
||||||
default:
|
default:
|
||||||
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -56,10 +56,10 @@ class RedisSessionConfiguration {
|
|||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
ConfigureRedisAction configureRedisAction(RedisSessionProperties redisSessionProperties) {
|
ConfigureRedisAction configureRedisAction(RedisSessionProperties redisSessionProperties) {
|
||||||
switch (redisSessionProperties.getConfigureAction()) {
|
switch (redisSessionProperties.getConfigureAction()) {
|
||||||
case NOTIFY_KEYSPACE_EVENTS:
|
case NOTIFY_KEYSPACE_EVENTS:
|
||||||
return new ConfigureNotifyKeyspaceEventsAction();
|
return new ConfigureNotifyKeyspaceEventsAction();
|
||||||
case NONE:
|
case NONE:
|
||||||
return ConfigureRedisAction.NO_OP;
|
return ConfigureRedisAction.NO_OP;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Unsupported redis configure action '" + redisSessionProperties.getConfigureAction() + "'.");
|
"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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
String getConfiguration(WebApplicationType webApplicationType) {
|
||||||
switch (webApplicationType) {
|
switch (webApplicationType) {
|
||||||
case SERVLET:
|
case SERVLET:
|
||||||
return getName(this.servletConfiguration);
|
return getName(this.servletConfiguration);
|
||||||
case REACTIVE:
|
case REACTIVE:
|
||||||
return getName(this.reactiveConfiguration);
|
return getName(this.reactiveConfiguration);
|
||||||
}
|
}
|
||||||
return null;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
|
||||||
switch (this.errorProperties.getIncludeStacktrace()) {
|
switch (this.errorProperties.getIncludeStacktrace()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return isTraceEnabled(request);
|
return isTraceEnabled(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,12 +190,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
|
|||||||
*/
|
*/
|
||||||
protected boolean isIncludeMessage(ServerRequest request, MediaType produces) {
|
protected boolean isIncludeMessage(ServerRequest request, MediaType produces) {
|
||||||
switch (this.errorProperties.getIncludeMessage()) {
|
switch (this.errorProperties.getIncludeMessage()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return isMessageEnabled(request);
|
return isMessageEnabled(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,12 +207,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
|
|||||||
*/
|
*/
|
||||||
protected boolean isIncludeBindingErrors(ServerRequest request, MediaType produces) {
|
protected boolean isIncludeBindingErrors(ServerRequest request, MediaType produces) {
|
||||||
switch (this.errorProperties.getIncludeBindingErrors()) {
|
switch (this.errorProperties.getIncludeBindingErrors()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return isBindingErrorsEnabled(request);
|
return isBindingErrorsEnabled(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) {
|
||||||
switch (getErrorProperties().getIncludeStacktrace()) {
|
switch (getErrorProperties().getIncludeStacktrace()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getTraceParameter(request);
|
return getTraceParameter(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,12 +149,12 @@ public class BasicErrorController extends AbstractErrorController {
|
|||||||
*/
|
*/
|
||||||
protected boolean isIncludeMessage(HttpServletRequest request, MediaType produces) {
|
protected boolean isIncludeMessage(HttpServletRequest request, MediaType produces) {
|
||||||
switch (getErrorProperties().getIncludeMessage()) {
|
switch (getErrorProperties().getIncludeMessage()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getMessageParameter(request);
|
return getMessageParameter(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,12 +166,12 @@ public class BasicErrorController extends AbstractErrorController {
|
|||||||
*/
|
*/
|
||||||
protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
|
protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
|
||||||
switch (getErrorProperties().getIncludeBindingErrors()) {
|
switch (getErrorProperties().getIncludeBindingErrors()) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
return true;
|
return true;
|
||||||
case ON_PARAM:
|
case ON_PARAM:
|
||||||
return getErrorsParameter(request);
|
return getErrorsParameter(request);
|
||||||
default:
|
default:
|
||||||
return false;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -27,12 +27,12 @@ public class MyReadinessStateExporter {
|
|||||||
@EventListener
|
@EventListener
|
||||||
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
|
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case ACCEPTING_TRAFFIC:
|
case ACCEPTING_TRAFFIC:
|
||||||
// create file /tmp/healthy
|
// create file /tmp/healthy
|
||||||
break;
|
break;
|
||||||
case REFUSING_TRAFFIC:
|
case REFUSING_TRAFFIC:
|
||||||
// remove file /tmp/healthy
|
// remove file /tmp/healthy
|
||||||
break;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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")
|
@SuppressWarnings("unchecked")
|
||||||
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
|
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
|
||||||
switch (filterType) {
|
switch (filterType) {
|
||||||
case ANNOTATION:
|
case ANNOTATION:
|
||||||
Assert.isAssignable(Annotation.class, filterClass,
|
Assert.isAssignable(Annotation.class, filterClass,
|
||||||
"An error occurred while processing an ANNOTATION type filter: ");
|
"An error occurred while processing an ANNOTATION type filter: ");
|
||||||
return new AnnotationTypeFilter((Class<Annotation>) filterClass);
|
return new AnnotationTypeFilter((Class<Annotation>) filterClass);
|
||||||
case ASSIGNABLE_TYPE:
|
case ASSIGNABLE_TYPE:
|
||||||
return new AssignableTypeFilter(filterClass);
|
return new AssignableTypeFilter(filterClass);
|
||||||
case CUSTOM:
|
case CUSTOM:
|
||||||
Assert.isAssignable(TypeFilter.class, filterClass,
|
Assert.isAssignable(TypeFilter.class, filterClass,
|
||||||
"An error occurred while processing a CUSTOM type filter: ");
|
"An error occurred while processing a CUSTOM type filter: ");
|
||||||
return BeanUtils.instantiateClass(filterClass, TypeFilter.class);
|
return BeanUtils.instantiateClass(filterClass, TypeFilter.class);
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
|
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {
|
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {
|
||||||
switch (filterType) {
|
switch (filterType) {
|
||||||
case ASPECTJ:
|
case ASPECTJ:
|
||||||
return new AspectJTypeFilter(pattern, this.classLoader);
|
return new AspectJTypeFilter(pattern, this.classLoader);
|
||||||
case REGEX:
|
case REGEX:
|
||||||
return new RegexPatternTypeFilter(Pattern.compile(pattern));
|
return new RegexPatternTypeFilter(Pattern.compile(pattern));
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
|
throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ public class LogUpdateEvent extends UpdateEvent {
|
|||||||
|
|
||||||
public void print() {
|
public void print() {
|
||||||
switch (this.streamType) {
|
switch (this.streamType) {
|
||||||
case STD_OUT:
|
case STD_OUT:
|
||||||
System.out.println(this);
|
System.out.println(this);
|
||||||
return;
|
return;
|
||||||
case STD_ERR:
|
case STD_ERR:
|
||||||
System.err.println(this);
|
System.err.println(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,40 +321,40 @@ public class JSONStringer {
|
|||||||
* reverse solidus, and the control characters (U+0000 through U+001F)."
|
* reverse solidus, and the control characters (U+0000 through U+001F)."
|
||||||
*/
|
*/
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '"':
|
case '"':
|
||||||
case '\\':
|
case '\\':
|
||||||
case '/':
|
case '/':
|
||||||
this.out.append('\\').append(c);
|
this.out.append('\\').append(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\t':
|
case '\t':
|
||||||
this.out.append("\\t");
|
this.out.append("\\t");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\b':
|
case '\b':
|
||||||
this.out.append("\\b");
|
this.out.append("\\b");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
this.out.append("\\n");
|
this.out.append("\\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\r':
|
case '\r':
|
||||||
this.out.append("\\r");
|
this.out.append("\\r");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\f':
|
case '\f':
|
||||||
this.out.append("\\f");
|
this.out.append("\\f");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (c <= 0x1F) {
|
if (c <= 0x1F) {
|
||||||
this.out.append(String.format("\\u%04x", (int) c));
|
this.out.append(String.format("\\u%04x", (int) c));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.out.append(c);
|
this.out.append(c);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,22 +91,22 @@ public class JSONTokener {
|
|||||||
public Object nextValue() throws JSONException {
|
public Object nextValue() throws JSONException {
|
||||||
int c = nextCleanInternal();
|
int c = nextCleanInternal();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case -1:
|
case -1:
|
||||||
throw syntaxError("End of input");
|
throw syntaxError("End of input");
|
||||||
|
|
||||||
case '{':
|
case '{':
|
||||||
return readObject();
|
return readObject();
|
||||||
|
|
||||||
case '[':
|
case '[':
|
||||||
return readArray();
|
return readArray();
|
||||||
|
|
||||||
case '\'':
|
case '\'':
|
||||||
case '"':
|
case '"':
|
||||||
return nextString((char) c);
|
return nextString((char) c);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this.pos--;
|
this.pos--;
|
||||||
return readLiteral();
|
return readLiteral();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,50 +114,50 @@ public class JSONTokener {
|
|||||||
while (this.pos < this.in.length()) {
|
while (this.pos < this.in.length()) {
|
||||||
int c = this.in.charAt(this.pos++);
|
int c = this.in.charAt(this.pos++);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\t':
|
case '\t':
|
||||||
case ' ':
|
case ' ':
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\r':
|
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;
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
// skip a // end-of-line comment
|
if (this.pos == this.in.length()) {
|
||||||
this.pos++;
|
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();
|
skipToEndOfLine();
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return c;
|
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 {
|
private char readEscapeCharacter() throws JSONException {
|
||||||
char escaped = this.in.charAt(this.pos++);
|
char escaped = this.in.charAt(this.pos++);
|
||||||
switch (escaped) {
|
switch (escaped) {
|
||||||
case 'u':
|
case 'u':
|
||||||
if (this.pos + 4 > this.in.length()) {
|
if (this.pos + 4 > this.in.length()) {
|
||||||
throw syntaxError("Unterminated escape sequence");
|
throw syntaxError("Unterminated escape sequence");
|
||||||
}
|
}
|
||||||
String hex = this.in.substring(this.pos, this.pos + 4);
|
String hex = this.in.substring(this.pos, this.pos + 4);
|
||||||
this.pos += 4;
|
this.pos += 4;
|
||||||
return (char) Integer.parseInt(hex, 16);
|
return (char) Integer.parseInt(hex, 16);
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
return '\t';
|
return '\t';
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
return '\b';
|
return '\b';
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
return '\n';
|
return '\n';
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
return '\r';
|
return '\r';
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
return '\f';
|
return '\f';
|
||||||
|
|
||||||
case '\'':
|
case '\'':
|
||||||
case '"':
|
case '"':
|
||||||
case '\\':
|
case '\\':
|
||||||
default:
|
default:
|
||||||
return escaped;
|
return escaped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,13 +396,13 @@ public class JSONTokener {
|
|||||||
result.put((String) name, nextValue());
|
result.put((String) name, nextValue());
|
||||||
|
|
||||||
switch (nextCleanInternal()) {
|
switch (nextCleanInternal()) {
|
||||||
case '}':
|
case '}':
|
||||||
return result;
|
return result;
|
||||||
case ';':
|
case ';':
|
||||||
case ',':
|
case ',':
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
throw syntaxError("Unterminated object");
|
throw syntaxError("Unterminated object");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,34 +422,34 @@ public class JSONTokener {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (nextCleanInternal()) {
|
switch (nextCleanInternal()) {
|
||||||
case -1:
|
case -1:
|
||||||
throw syntaxError("Unterminated array");
|
throw syntaxError("Unterminated array");
|
||||||
case ']':
|
case ']':
|
||||||
if (hasTrailingSeparator) {
|
if (hasTrailingSeparator) {
|
||||||
|
result.put(null);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
case ',':
|
||||||
|
case ';':
|
||||||
|
/* A separator without a value first means "null". */
|
||||||
result.put(null);
|
result.put(null);
|
||||||
}
|
hasTrailingSeparator = true;
|
||||||
return result;
|
continue;
|
||||||
case ',':
|
default:
|
||||||
case ';':
|
this.pos--;
|
||||||
/* A separator without a value first means "null". */
|
|
||||||
result.put(null);
|
|
||||||
hasTrailingSeparator = true;
|
|
||||||
continue;
|
|
||||||
default:
|
|
||||||
this.pos--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put(nextValue());
|
result.put(nextValue());
|
||||||
|
|
||||||
switch (nextCleanInternal()) {
|
switch (nextCleanInternal()) {
|
||||||
case ']':
|
case ']':
|
||||||
return result;
|
return result;
|
||||||
case ',':
|
case ',':
|
||||||
case ';':
|
case ';':
|
||||||
hasTrailingSeparator = true;
|
hasTrailingSeparator = true;
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
throw syntaxError("Unterminated array");
|
throw syntaxError("Unterminated array");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,12 +356,12 @@ public class SpringApplication {
|
|||||||
|
|
||||||
private Class<? extends StandardEnvironment> deduceEnvironmentClass() {
|
private Class<? extends StandardEnvironment> deduceEnvironmentClass() {
|
||||||
switch (this.webApplicationType) {
|
switch (this.webApplicationType) {
|
||||||
case SERVLET:
|
case SERVLET:
|
||||||
return ApplicationServletEnvironment.class;
|
return ApplicationServletEnvironment.class;
|
||||||
case REACTIVE:
|
case REACTIVE:
|
||||||
return ApplicationReactiveWebEnvironment.class;
|
return ApplicationReactiveWebEnvironment.class;
|
||||||
default:
|
default:
|
||||||
return ApplicationEnvironment.class;
|
return ApplicationEnvironment.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,12 +457,12 @@ public class SpringApplication {
|
|||||||
return this.environment;
|
return this.environment;
|
||||||
}
|
}
|
||||||
switch (this.webApplicationType) {
|
switch (this.webApplicationType) {
|
||||||
case SERVLET:
|
case SERVLET:
|
||||||
return new ApplicationServletEnvironment();
|
return new ApplicationServletEnvironment();
|
||||||
case REACTIVE:
|
case REACTIVE:
|
||||||
return new ApplicationReactiveWebEnvironment();
|
return new ApplicationReactiveWebEnvironment();
|
||||||
default:
|
default:
|
||||||
return new ApplicationEnvironment();
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
static void logTo(Log log, LogLevel level, Object message, Throwable throwable) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case TRACE:
|
case TRACE:
|
||||||
log.trace(message, throwable);
|
log.trace(message, throwable);
|
||||||
return;
|
return;
|
||||||
case DEBUG:
|
case DEBUG:
|
||||||
log.debug(message, throwable);
|
log.debug(message, throwable);
|
||||||
return;
|
return;
|
||||||
case INFO:
|
case INFO:
|
||||||
log.info(message, throwable);
|
log.info(message, throwable);
|
||||||
return;
|
return;
|
||||||
case WARN:
|
case WARN:
|
||||||
log.warn(message, throwable);
|
log.warn(message, throwable);
|
||||||
return;
|
return;
|
||||||
case ERROR:
|
case ERROR:
|
||||||
log.error(message, throwable);
|
log.error(message, throwable);
|
||||||
return;
|
return;
|
||||||
case FATAL:
|
case FATAL:
|
||||||
log.fatal(message, throwable);
|
log.fatal(message, throwable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,12 +717,12 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
|
|||||||
|
|
||||||
private String getSameSiteComment(SameSite sameSite) {
|
private String getSameSiteComment(SameSite sameSite) {
|
||||||
switch (sameSite) {
|
switch (sameSite) {
|
||||||
case NONE:
|
case NONE:
|
||||||
return HttpCookie.SAME_SITE_NONE_COMMENT;
|
return HttpCookie.SAME_SITE_NONE_COMMENT;
|
||||||
case LAX:
|
case LAX:
|
||||||
return HttpCookie.SAME_SITE_LAX_COMMENT;
|
return HttpCookie.SAME_SITE_LAX_COMMENT;
|
||||||
case STRICT:
|
case STRICT:
|
||||||
return HttpCookie.SAME_SITE_STRICT_COMMENT;
|
return HttpCookie.SAME_SITE_STRICT_COMMENT;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Unsupported SameSite value " + sameSite);
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public Location getAdjacentLocation(Direction direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
||||||
case EAST:
|
case EAST:
|
||||||
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
||||||
case WEST:
|
case WEST:
|
||||||
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
||||||
case NONE:
|
case NONE:
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
return this;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public Location getAdjacentLocation(Direction direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
||||||
case EAST:
|
case EAST:
|
||||||
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
||||||
case WEST:
|
case WEST:
|
||||||
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
||||||
case NONE:
|
case NONE:
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
return this;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public Location getAdjacentLocation(Direction direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
||||||
case EAST:
|
case EAST:
|
||||||
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
||||||
case WEST:
|
case WEST:
|
||||||
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
||||||
case NONE:
|
case NONE:
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
return this;
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public Location getAdjacentLocation(Direction direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y - SnakeUtils.GRID_SIZE);
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
return new Location(this.x, this.y + SnakeUtils.GRID_SIZE);
|
||||||
case EAST:
|
case EAST:
|
||||||
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x + SnakeUtils.GRID_SIZE, this.y);
|
||||||
case WEST:
|
case WEST:
|
||||||
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
return new Location(this.x - SnakeUtils.GRID_SIZE, this.y);
|
||||||
case NONE:
|
case NONE:
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user