Use Locale.ROOT consistently for toLower/toUpperCase
Closes gh-33708
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
@@ -750,7 +751,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]));
|
||||
@@ -942,7 +943,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;
|
||||
}
|
||||
@@ -1038,7 +1039,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
if (t.getKind().hasPayload()) {
|
||||
return t.stringValue();
|
||||
}
|
||||
return t.kind.toString().toLowerCase();
|
||||
return t.kind.toString().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private void checkOperands(Token token, @Nullable SpelNodeImpl left, @Nullable SpelNodeImpl right) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user