Merge branch '6.1.x'

This commit is contained in:
Juergen Hoeller
2024-10-16 13:46:22 +02:00
27 changed files with 93 additions and 66 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.expression.spel;
import java.util.Locale;
import org.springframework.core.SpringProperties;
import org.springframework.lang.Nullable;
@@ -46,7 +48,7 @@ public class SpelParserConfiguration {
static {
String compilerMode = SpringProperties.getProperty(SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME);
defaultCompilerMode = (compilerMode != null ?
SpelCompilerMode.valueOf(compilerMode.toUpperCase()) : SpelCompilerMode.OFF);
SpelCompilerMode.valueOf(compilerMode.toUpperCase(Locale.ROOT)) : SpelCompilerMode.OFF);
}

View File

@@ -17,6 +17,7 @@
package org.springframework.expression.spel.ast;
import java.lang.reflect.Array;
import java.util.Locale;
import org.springframework.asm.MethodVisitor;
import org.springframework.asm.Type;
@@ -58,7 +59,7 @@ public class TypeReference extends SpelNodeImpl {
String typeName = (String) this.children[0].getValueInternal(state).getValue();
Assert.state(typeName != null, "No type name");
if (!typeName.contains(".") && Character.isLowerCase(typeName.charAt(0))) {
TypeCode tc = TypeCode.valueOf(typeName.toUpperCase());
TypeCode tc = TypeCode.valueOf(typeName.toUpperCase(Locale.ROOT));
if (tc != TypeCode.OBJECT) {
// It is a primitive type
Class<?> clazz = makeArrayIfNecessary(tc.getType());

View File

@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Pattern;
@@ -755,7 +756,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
throw internalException( this.expressionString.length(), SpelMessage.OOD);
}
throw internalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
"qualified ID", node.getKind().toString().toLowerCase());
"qualified ID", node.getKind().toString().toLowerCase(Locale.ROOT));
}
return new QualifiedIdentifier(qualifiedIdPieces.getFirst().getStartPosition(),
qualifiedIdPieces.getLast().getEndPosition(), qualifiedIdPieces.toArray(new SpelNodeImpl[0]));
@@ -948,7 +949,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
}
if (t.kind != expectedKind) {
throw internalException(t.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
expectedKind.toString().toLowerCase(), t.getKind().toString().toLowerCase());
expectedKind.toString().toLowerCase(Locale.ROOT), t.getKind().toString().toLowerCase(Locale.ROOT));
}
return t;
}
@@ -1044,7 +1045,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if (t.getKind().hasPayload()) {
return t.stringValue();
}
return t.kind.toString().toLowerCase();
return t.kind.toString().toLowerCase(Locale.ROOT);
}
@Contract("_, null, _ -> fail; _, _, null -> fail")

View File

@@ -19,6 +19,7 @@ package org.springframework.expression.spel.standard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.springframework.expression.spel.InternalParseException;
import org.springframework.expression.spel.SpelMessage;
@@ -457,7 +458,7 @@ class Tokenizer {
// Check if this is the alternative (textual) representation of an operator (see
// ALTERNATIVE_OPERATOR_NAMES).
if (subarray.length == 2 || subarray.length == 3) {
String asString = new String(subarray).toUpperCase();
String asString = new String(subarray).toUpperCase(Locale.ROOT);
int idx = Arrays.binarySearch(ALTERNATIVE_OPERATOR_NAMES, asString);
if (idx >= 0) {
pushOneCharOrTwoCharToken(TokenKind.valueOf(asString), start, subarray);