Polish contribution
See gh-28014
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -61,16 +61,15 @@ public class AbstractPropertyAccessorBenchmark {
|
|||||||
this.propertyAccessor = new BeanWrapperImpl(this.target);
|
this.propertyAccessor = new BeanWrapperImpl(this.target);
|
||||||
}
|
}
|
||||||
switch (this.customEditor) {
|
switch (this.customEditor) {
|
||||||
case "stringTrimmer" -> this.propertyAccessor.registerCustomEditor(String.class,
|
case "stringTrimmer" ->
|
||||||
new StringTrimmerEditor(false));
|
this.propertyAccessor.registerCustomEditor(String.class, new StringTrimmerEditor(false));
|
||||||
case "numberOnPath" -> this.propertyAccessor.registerCustomEditor(int.class, "array.somePath",
|
case "numberOnPath" ->
|
||||||
new CustomNumberEditor(Integer.class, false));
|
this.propertyAccessor.registerCustomEditor(int.class, "array.somePath", new CustomNumberEditor(Integer.class, false));
|
||||||
case "numberOnNestedPath" -> this.propertyAccessor.registerCustomEditor(int.class, "array[0].somePath",
|
case "numberOnNestedPath" ->
|
||||||
new CustomNumberEditor(Integer.class, false));
|
this.propertyAccessor.registerCustomEditor(int.class, "array[0].somePath", new CustomNumberEditor(Integer.class, false));
|
||||||
case "numberOnType" -> this.propertyAccessor.registerCustomEditor(int.class,
|
case "numberOnType" ->
|
||||||
new CustomNumberEditor(Integer.class, false));
|
this.propertyAccessor.registerCustomEditor(int.class, new CustomNumberEditor(Integer.class, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -94,4 +93,5 @@ public class AbstractPropertyAccessorBenchmark {
|
|||||||
this.array = array;
|
this.array = array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -353,8 +353,8 @@ public class MimeMessageHelper {
|
|||||||
rootMixedMultipart.addBodyPart(relatedBodyPart);
|
rootMixedMultipart.addBodyPart(relatedBodyPart);
|
||||||
setMimeMultiparts(rootMixedMultipart, nestedRelatedMultipart);
|
setMimeMultiparts(rootMixedMultipart, nestedRelatedMultipart);
|
||||||
}
|
}
|
||||||
default -> throw new IllegalArgumentException(
|
default ->
|
||||||
"Only multipart modes MIXED_RELATED, RELATED and NO supported");
|
throw new IllegalArgumentException("Only multipart modes MIXED_RELATED, RELATED and NO supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -93,8 +93,8 @@ public abstract class TypeFilterUtils {
|
|||||||
environment, resourceLoader, registry);
|
environment, resourceLoader, registry);
|
||||||
typeFilters.add(filter);
|
typeFilters.add(filter);
|
||||||
}
|
}
|
||||||
default -> throw new IllegalArgumentException(
|
default ->
|
||||||
"Filter type not supported with Class value: " + filterType);
|
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ public abstract class TypeFilterUtils {
|
|||||||
switch (filterType) {
|
switch (filterType) {
|
||||||
case ASPECTJ -> typeFilters.add(new AspectJTypeFilter(expression, resourceLoader.getClassLoader()));
|
case ASPECTJ -> typeFilters.add(new AspectJTypeFilter(expression, resourceLoader.getClassLoader()));
|
||||||
case REGEX -> typeFilters.add(new RegexPatternTypeFilter(Pattern.compile(expression)));
|
case REGEX -> typeFilters.add(new RegexPatternTypeFilter(Pattern.compile(expression)));
|
||||||
default -> throw new IllegalArgumentException(
|
default ->
|
||||||
"Filter type not supported with String pattern: " + filterType);
|
throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -46,8 +46,8 @@ public class AsyncConfigurationSelector extends AdviceModeImportSelector<EnableA
|
|||||||
@NonNull
|
@NonNull
|
||||||
public String[] selectImports(AdviceMode adviceMode) {
|
public String[] selectImports(AdviceMode adviceMode) {
|
||||||
return switch (adviceMode) {
|
return switch (adviceMode) {
|
||||||
case PROXY -> new String[]{ProxyAsyncConfiguration.class.getName()};
|
case PROXY -> new String[] {ProxyAsyncConfiguration.class.getName()};
|
||||||
case ASPECTJ -> new String[]{ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME};
|
case ASPECTJ -> new String[] {ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,13 +163,22 @@ public final class TypePath {
|
|||||||
int length = getLength();
|
int length = getLength();
|
||||||
StringBuilder result = new StringBuilder(length * 2);
|
StringBuilder result = new StringBuilder(length * 2);
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
switch (getStep(i)) {
|
switch (getStep(i)) {
|
||||||
case ARRAY_ELEMENT -> result.append('[');
|
case ARRAY_ELEMENT:
|
||||||
case INNER_TYPE -> result.append('.');
|
result.append('[');
|
||||||
case WILDCARD_BOUND -> result.append('*');
|
break;
|
||||||
case TYPE_ARGUMENT -> result.append(getStepArgument(i)).append(';');
|
case INNER_TYPE:
|
||||||
default -> throw new AssertionError();
|
result.append('.');
|
||||||
}
|
break;
|
||||||
|
case WILDCARD_BOUND:
|
||||||
|
result.append('*');
|
||||||
|
break;
|
||||||
|
case TYPE_ARGUMENT:
|
||||||
|
result.append(getStepArgument(i)).append(';');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -607,8 +607,10 @@ public abstract class DataBufferUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static NestedMatcher createMatcher(byte[] delimiter) {
|
private static NestedMatcher createMatcher(byte[] delimiter) {
|
||||||
Assert.isTrue(delimiter.length > 0, "Delimiter must not be empty");
|
// extract length due to Eclipse IDE compiler error in switch expression
|
||||||
return switch (delimiter.length) {
|
int length = delimiter.length;
|
||||||
|
Assert.isTrue(length > 0, "Delimiter must not be empty");
|
||||||
|
return switch (length) {
|
||||||
case 1 -> (delimiter[0] == 10 ? SingleByteMatcher.NEWLINE_MATCHER : new SingleByteMatcher(delimiter));
|
case 1 -> (delimiter[0] == 10 ? SingleByteMatcher.NEWLINE_MATCHER : new SingleByteMatcher(delimiter));
|
||||||
case 2 -> new TwoByteMatcher(delimiter);
|
case 2 -> new TwoByteMatcher(delimiter);
|
||||||
default -> new KnuthMorrisPrattMatcher(delimiter);
|
default -> new KnuthMorrisPrattMatcher(delimiter);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -145,9 +145,8 @@ public class DefaultSubscriptionRegistryBenchmark {
|
|||||||
@Setup(Level.Trial)
|
@Setup(Level.Trial)
|
||||||
public void doSetup(ServerState serverState) {
|
public void doSetup(ServerState serverState) {
|
||||||
switch (this.contention) {
|
switch (this.contention) {
|
||||||
case "noSubscribers" -> {
|
case "noSubscribers" ->
|
||||||
this.destination = "someDestination_withNoSubscribers_" + serverState.uniqueIdGenerator.incrementAndGet();
|
this.destination = "someDestination_withNoSubscribers_" + serverState.uniqueIdGenerator.incrementAndGet();
|
||||||
}
|
|
||||||
case "sameDestination" -> this.destination = serverState.destinationIds[0];
|
case "sameDestination" -> this.destination = serverState.destinationIds[0];
|
||||||
case "none" -> {
|
case "none" -> {
|
||||||
int uniqueNumber = serverState.uniqueIdGenerator.getAndIncrement();
|
int uniqueNumber = serverState.uniqueIdGenerator.getAndIncrement();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -197,10 +197,10 @@ public class RSocketFrameTypeMessageCondition extends AbstractMessageCondition<R
|
|||||||
case 0 -> REQUEST_FNF_OR_RESPONSE_CONDITION;
|
case 0 -> REQUEST_FNF_OR_RESPONSE_CONDITION;
|
||||||
case 1 -> REQUEST_RESPONSE_CONDITION;
|
case 1 -> REQUEST_RESPONSE_CONDITION;
|
||||||
case 2 -> REQUEST_STREAM_CONDITION;
|
case 2 -> REQUEST_STREAM_CONDITION;
|
||||||
default -> throw new IllegalStateException("Invalid cardinality: " + cardinalityOut);
|
default -> throw new IllegalStateException("Invalid response cardinality: " + cardinalityOut);
|
||||||
};
|
};
|
||||||
case 2 -> REQUEST_CHANNEL_CONDITION;
|
case 2 -> REQUEST_CHANNEL_CONDITION;
|
||||||
default -> throw new IllegalStateException("Invalid cardinality: " + cardinalityIn);
|
default -> throw new IllegalStateException("Invalid request cardinality: " + cardinalityIn);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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,19 +173,16 @@ public class MockPageContext extends PageContext {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public Object getAttribute(String name, int scope) {
|
public Object getAttribute(String name, int scope) {
|
||||||
Assert.notNull(name, "Attribute name must not be null");
|
Assert.notNull(name, "Attribute name must not be null");
|
||||||
switch (scope) {
|
return switch (scope) {
|
||||||
case PAGE_SCOPE:
|
case PAGE_SCOPE -> getAttribute(name);
|
||||||
return getAttribute(name);
|
case REQUEST_SCOPE -> this.request.getAttribute(name);
|
||||||
case REQUEST_SCOPE:
|
case SESSION_SCOPE -> {
|
||||||
return this.request.getAttribute(name);
|
|
||||||
case SESSION_SCOPE:
|
|
||||||
HttpSession session = this.request.getSession(false);
|
HttpSession session = this.request.getSession(false);
|
||||||
return (session != null ? session.getAttribute(name) : null);
|
yield (session != null ? session.getAttribute(name) : null);
|
||||||
case APPLICATION_SCOPE:
|
}
|
||||||
return this.servletContext.getAttribute(name);
|
case APPLICATION_SCOPE -> this.servletContext.getAttribute(name);
|
||||||
default:
|
default -> throw new IllegalArgumentException("Invalid scope: " + scope);
|
||||||
throw new IllegalArgumentException("Invalid scope: " + scope);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -250,19 +247,16 @@ public class MockPageContext extends PageContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<String> getAttributeNamesInScope(int scope) {
|
public Enumeration<String> getAttributeNamesInScope(int scope) {
|
||||||
switch (scope) {
|
return switch (scope) {
|
||||||
case PAGE_SCOPE:
|
case PAGE_SCOPE -> getAttributeNames();
|
||||||
return getAttributeNames();
|
case REQUEST_SCOPE -> this.request.getAttributeNames();
|
||||||
case REQUEST_SCOPE:
|
case SESSION_SCOPE -> {
|
||||||
return this.request.getAttributeNames();
|
|
||||||
case SESSION_SCOPE:
|
|
||||||
HttpSession session = this.request.getSession(false);
|
HttpSession session = this.request.getSession(false);
|
||||||
return (session != null ? session.getAttributeNames() : Collections.emptyEnumeration());
|
yield (session != null ? session.getAttributeNames() : Collections.emptyEnumeration());
|
||||||
case APPLICATION_SCOPE:
|
}
|
||||||
return this.servletContext.getAttributeNames();
|
case APPLICATION_SCOPE -> this.servletContext.getAttributeNames();
|
||||||
default:
|
default -> throw new IllegalArgumentException("Invalid scope: " + scope);
|
||||||
throw new IllegalArgumentException("Invalid scope: " + scope);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -171,9 +171,12 @@ public class SpringJtaSynchronizationAdapter implements Synchronization {
|
|||||||
}
|
}
|
||||||
// Call afterCompletion with the appropriate status indication.
|
// Call afterCompletion with the appropriate status indication.
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case Status.STATUS_COMMITTED -> this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_COMMITTED);
|
case Status.STATUS_COMMITTED ->
|
||||||
case Status.STATUS_ROLLEDBACK -> this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_ROLLED_BACK);
|
this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_COMMITTED);
|
||||||
default -> this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_UNKNOWN);
|
case Status.STATUS_ROLLEDBACK ->
|
||||||
|
this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_ROLLED_BACK);
|
||||||
|
default ->
|
||||||
|
this.springSynchronization.afterCompletion(TransactionSynchronization.STATUS_UNKNOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -164,9 +164,12 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
|
|||||||
String message = getErrorMessage(statusCode.value(), statusText, body, charset);
|
String message = getErrorMessage(statusCode.value(), statusText, body, charset);
|
||||||
|
|
||||||
switch (statusCode.series()) {
|
switch (statusCode.series()) {
|
||||||
case CLIENT_ERROR -> throw HttpClientErrorException.create(message, statusCode, statusText, headers, body, charset);
|
case CLIENT_ERROR ->
|
||||||
case SERVER_ERROR -> throw HttpServerErrorException.create(message, statusCode, statusText, headers, body, charset);
|
throw HttpClientErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||||
default -> throw new UnknownHttpStatusCodeException(message, statusCode.value(), statusText, headers, body, charset);
|
case SERVER_ERROR ->
|
||||||
|
throw HttpServerErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||||
|
default ->
|
||||||
|
throw new UnknownHttpStatusCodeException(message, statusCode.value(), statusText, headers, body, charset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-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,19 +173,16 @@ public class MockPageContext extends PageContext {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public Object getAttribute(String name, int scope) {
|
public Object getAttribute(String name, int scope) {
|
||||||
Assert.notNull(name, "Attribute name must not be null");
|
Assert.notNull(name, "Attribute name must not be null");
|
||||||
switch (scope) {
|
return switch (scope) {
|
||||||
case PAGE_SCOPE:
|
case PAGE_SCOPE -> getAttribute(name);
|
||||||
return getAttribute(name);
|
case REQUEST_SCOPE -> this.request.getAttribute(name);
|
||||||
case REQUEST_SCOPE:
|
case SESSION_SCOPE -> {
|
||||||
return this.request.getAttribute(name);
|
|
||||||
case SESSION_SCOPE:
|
|
||||||
HttpSession session = this.request.getSession(false);
|
HttpSession session = this.request.getSession(false);
|
||||||
return (session != null ? session.getAttribute(name) : null);
|
yield (session != null ? session.getAttribute(name) : null);
|
||||||
case APPLICATION_SCOPE:
|
}
|
||||||
return this.servletContext.getAttribute(name);
|
case APPLICATION_SCOPE -> this.servletContext.getAttribute(name);
|
||||||
default:
|
default -> throw new IllegalArgumentException("Invalid scope: " + scope);
|
||||||
throw new IllegalArgumentException("Invalid scope: " + scope);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -250,19 +247,16 @@ public class MockPageContext extends PageContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<String> getAttributeNamesInScope(int scope) {
|
public Enumeration<String> getAttributeNamesInScope(int scope) {
|
||||||
switch (scope) {
|
return switch (scope) {
|
||||||
case PAGE_SCOPE:
|
case PAGE_SCOPE -> getAttributeNames();
|
||||||
return getAttributeNames();
|
case REQUEST_SCOPE -> this.request.getAttributeNames();
|
||||||
case REQUEST_SCOPE:
|
case SESSION_SCOPE -> {
|
||||||
return this.request.getAttributeNames();
|
|
||||||
case SESSION_SCOPE:
|
|
||||||
HttpSession session = this.request.getSession(false);
|
HttpSession session = this.request.getSession(false);
|
||||||
return (session != null ? session.getAttributeNames() : Collections.emptyEnumeration());
|
yield (session != null ? session.getAttributeNames() : Collections.emptyEnumeration());
|
||||||
case APPLICATION_SCOPE:
|
}
|
||||||
return this.servletContext.getAttributeNames();
|
case APPLICATION_SCOPE -> this.servletContext.getAttributeNames();
|
||||||
default:
|
default -> throw new IllegalArgumentException("Invalid scope: " + scope);
|
||||||
throw new IllegalArgumentException("Invalid scope: " + scope);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -90,15 +90,15 @@ class ViewControllerBeanDefinitionParser implements BeanDefinitionParser {
|
|||||||
controller.getPropertyValues().add("statusCode", statusCode);
|
controller.getPropertyValues().add("statusCode", statusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "redirect-view-controller" -> controller.getPropertyValues()
|
case "redirect-view-controller" ->
|
||||||
.add("view", getRedirectView(element, statusCode, source));
|
controller.getPropertyValues().add("view", getRedirectView(element, statusCode, source));
|
||||||
case "status-controller" -> {
|
case "status-controller" -> {
|
||||||
controller.getPropertyValues().add("statusCode", statusCode);
|
controller.getPropertyValues().add("statusCode", statusCode);
|
||||||
controller.getPropertyValues().add("statusOnly", true);
|
controller.getPropertyValues().add("statusOnly", true);
|
||||||
}
|
}
|
||||||
default ->
|
default ->
|
||||||
// Should never happen...
|
// Should never happen...
|
||||||
throw new IllegalStateException("Unexpected tag name: " + name);
|
throw new IllegalStateException("Unexpected tag name: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, BeanDefinition> urlMap = (Map<String, BeanDefinition>) hm.getPropertyValues().get("urlMap");
|
Map<String, BeanDefinition> urlMap = (Map<String, BeanDefinition>) hm.getPropertyValues().get("urlMap");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -229,6 +229,9 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
|
|||||||
logger.debug("Dropped " + i + " messages, buffer size: " + getBufferSize());
|
logger.debug("Dropped " + i + " messages, buffer size: " + getBufferSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default ->
|
||||||
|
// Should never happen..
|
||||||
|
throw new IllegalStateException("Unexpected OverflowStrategy: " + this.overflowStrategy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-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.
|
||||||
@@ -410,7 +410,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
|||||||
return switch (messages.length - i) {
|
return switch (messages.length - i) {
|
||||||
case 0 -> Collections.emptyList();
|
case 0 -> Collections.emptyList();
|
||||||
case 1 -> (messages[i].trim().isEmpty() ?
|
case 1 -> (messages[i].trim().isEmpty() ?
|
||||||
Collections.<String>emptyList() : Collections.singletonList(messages[i]));
|
Collections.<String>emptyList() : Collections.singletonList(messages[i]));
|
||||||
default -> Arrays.stream(Arrays.copyOfRange(messages, i, messages.length))
|
default -> Arrays.stream(Arrays.copyOfRange(messages, i, messages.length))
|
||||||
.filter(message -> !message.trim().isEmpty())
|
.filter(message -> !message.trim().isEmpty())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user