Merge branch '6.1.x'

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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -19,6 +19,7 @@ package org.springframework.beans.support;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -77,8 +78,8 @@ public class PropertyComparator<T> implements Comparator<T> {
Object v1 = getPropertyValue(o1);
Object v2 = getPropertyValue(o2);
if (this.sortDefinition.isIgnoreCase() && (v1 instanceof String text1) && (v2 instanceof String text2)) {
v1 = text1.toLowerCase();
v2 = text2.toLowerCase();
v1 = text1.toLowerCase(Locale.ROOT);
v2 = text2.toLowerCase(Locale.ROOT);
}
int result;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 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.
@ -19,6 +19,7 @@ package org.springframework.scheduling.quartz;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Locale;
import javax.sql.DataSource;
@ -156,7 +157,7 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
String productName = JdbcUtils.extractDatabaseMetaData(this.dataSource,
DatabaseMetaData::getDatabaseProductName);
productName = JdbcUtils.commonDatabaseName(productName);
if (productName != null && productName.toLowerCase().contains("hsql")) {
if (productName != null && productName.toLowerCase(Locale.ROOT).contains("hsql")) {
setUseDBLocks(false);
setLockHandler(new SimpleSemaphore());
}

View File

@ -34,7 +34,7 @@ class MonthFormatter implements Formatter<Month> {
@Override
public Month parse(String text, Locale locale) throws ParseException {
return Month.valueOf(text.toUpperCase());
return Month.valueOf(text.toUpperCase(Locale.ROOT));
}
@Override

View File

@ -21,6 +21,7 @@ import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.ValueRange;
import java.util.Locale;
import java.util.function.BiFunction;
import org.springframework.lang.Nullable;
@ -143,7 +144,7 @@ abstract class CronField {
}
private static String replaceOrdinals(String value, String[] list) {
value = value.toUpperCase();
value = value.toUpperCase(Locale.ROOT);
for (int i = 0; i < list.length; i++) {
String replacement = Integer.toString(i + 1);
value = StringUtils.replace(value, list[i], replacement);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@ -17,6 +17,7 @@
package org.springframework.aot.agent;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import org.springframework.asm.ClassVisitor;
@ -40,6 +41,7 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
private final ClassWriter classWriter;
public InvocationsRecorderClassVisitor() {
this(new ClassWriter(ClassWriter.COMPUTE_MAXS));
}
@ -49,6 +51,7 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
this.classWriter = classWriter;
}
public boolean isTransformed() {
return this.isTransformed;
}
@ -64,6 +67,7 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
return new InvocationsRecorderMethodVisitor(mv);
}
@SuppressWarnings("deprecation")
class InvocationsRecorderMethodVisitor extends MethodVisitor implements Opcodes {
@ -83,7 +87,6 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
super(SpringAsmInfo.ASM_VERSION, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
if (isOpcodeSupported(opcode) && shouldRecordMethodCall(owner, name)) {
@ -116,7 +119,6 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
}
private boolean shouldRecordMethodCall(String owner, String method) {
String methodReference = owner + "#" + method;
return instrumentedMethods.contains(methodReference);
@ -124,13 +126,12 @@ class InvocationsRecorderClassVisitor extends ClassVisitor implements Opcodes {
private String rewriteMethodName(String owner, String methodName) {
int classIndex = owner.lastIndexOf('/');
return owner.substring(classIndex + 1).toLowerCase() + methodName;
return owner.substring(classIndex + 1).toLowerCase(Locale.ROOT) + methodName;
}
private String rewriteDescriptor(int opcode, String owner, String name, String descriptor) {
return (opcode == Opcodes.INVOKESTATIC || opcode == Opcodes.H_INVOKESTATIC) ? descriptor : "(L" + owner + ";" + descriptor.substring(1);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@ -16,6 +16,7 @@
package org.springframework.core.convert.support;
import java.util.Locale;
import java.util.Set;
import org.springframework.core.convert.converter.Converter;
@ -43,7 +44,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
if (value.isEmpty()) {
return null;
}
value = value.toLowerCase();
value = value.toLowerCase(Locale.ROOT);
if (trueValues.contains(value)) {
return Boolean.TRUE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 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.
@ -16,6 +16,7 @@
package org.springframework.core.env;
import java.util.Locale;
import java.util.Map;
import org.springframework.lang.Nullable;
@ -109,7 +110,7 @@ public class SystemEnvironmentPropertySource extends MapPropertySource {
if (resolvedName != null) {
return resolvedName;
}
String uppercasedName = name.toUpperCase();
String uppercasedName = name.toUpperCase(Locale.ROOT);
if (!name.equals(uppercasedName)) {
resolvedName = checkPropertyName(uppercasedName);
if (resolvedName != null) {

View File

@ -24,6 +24,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import org.springframework.lang.Nullable;
@ -306,7 +307,7 @@ public abstract class ResourceUtils {
*/
public static boolean isJarFileURL(URL url) {
return (URL_PROTOCOL_FILE.equals(url.getProtocol()) &&
url.getPath().toLowerCase().endsWith(JAR_FILE_EXTENSION));
url.getPath().toLowerCase(Locale.ROOT).endsWith(JAR_FILE_EXTENSION));
}
/**

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

View File

@ -385,7 +385,7 @@ public class CallMetaDataContext {
if (meta.isReturnParameter()) {
param = declaredParams.get(getFunctionReturnName());
if (param == null && !getOutParameterNames().isEmpty()) {
param = declaredParams.get(getOutParameterNames().get(0).toLowerCase());
param = declaredParams.get(getOutParameterNames().get(0).toLowerCase(Locale.ROOT));
}
if (param == null) {
throw new InvalidDataAccessApiUsageException(
@ -488,7 +488,7 @@ public class CallMetaDataContext {
String parameterName = parameter.getName();
String parameterNameToMatch = obtainMetaDataProvider().parameterNameToUse(parameterName);
if (parameterNameToMatch != null) {
callParameterNames.put(parameterNameToMatch.toLowerCase(), parameterName);
callParameterNames.put(parameterNameToMatch.toLowerCase(Locale.ROOT), parameterName);
}
if (parameterName != null) {
if (parameterSource.hasValue(parameterName)) {
@ -496,7 +496,7 @@ public class CallMetaDataContext {
SqlParameterSourceUtils.getTypedValue(parameterSource, parameterName));
}
else {
String lowerCaseName = parameterName.toLowerCase();
String lowerCaseName = parameterName.toLowerCase(Locale.ROOT);
if (parameterSource.hasValue(lowerCaseName)) {
matchedParameters.put(parameterName,
SqlParameterSourceUtils.getTypedValue(parameterSource, lowerCaseName));
@ -556,7 +556,7 @@ public class CallMetaDataContext {
String parameterName = parameter.getName();
String parameterNameToMatch = provider.parameterNameToUse(parameterName);
if (parameterNameToMatch != null) {
callParameterNames.put(parameterNameToMatch.toLowerCase(), parameterName);
callParameterNames.put(parameterNameToMatch.toLowerCase(Locale.ROOT), parameterName);
}
}
}
@ -681,7 +681,7 @@ public class CallMetaDataContext {
}
private static String lowerCase(@Nullable String paramName) {
return (paramName != null ? paramName.toLowerCase() : "");
return (paramName != null ? paramName.toLowerCase(Locale.ROOT) : "");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 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.
@ -18,6 +18,7 @@ package org.springframework.jdbc.core.metadata;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Locale;
import org.springframework.lang.Nullable;
@ -73,7 +74,7 @@ public class Db2CallMetaDataProvider extends GenericCallMetaDataProvider {
// Use current user schema if no schema specified...
String userName = getUserName();
return (userName != null ? userName.toUpperCase() : null);
return (userName != null ? userName.toUpperCase(Locale.ROOT) : null);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 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.
@ -18,6 +18,7 @@ package org.springframework.jdbc.core.metadata;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Locale;
import org.springframework.lang.Nullable;
@ -45,7 +46,7 @@ public class DerbyCallMetaDataProvider extends GenericCallMetaDataProvider {
// Use current user schema if no schema specified...
String userName = getUserName();
return (userName != null ? userName.toUpperCase() : null);
return (userName != null ? userName.toUpperCase(Locale.ROOT) : null);
}
}

View File

@ -22,6 +22,7 @@ import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -284,10 +285,10 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return identifierName.toUpperCase();
return identifierName.toUpperCase(Locale.ROOT);
}
else if (isStoresLowerCaseIdentifiers()) {
return identifierName.toLowerCase();
return identifierName.toLowerCase(Locale.ROOT);
}
else {
return identifierName;

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.logging.Log;
@ -214,10 +215,10 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
return null;
}
else if (isStoresUpperCaseIdentifiers()) {
return identifierName.toUpperCase();
return identifierName.toUpperCase(Locale.ROOT);
}
else if (isStoresLowerCaseIdentifiers()) {
return identifierName.toLowerCase();
return identifierName.toLowerCase(Locale.ROOT);
}
else {
return identifierName;
@ -326,10 +327,10 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
TableMetaData tmd = new TableMetaData(tables.getString("TABLE_CAT"),
tables.getString("TABLE_SCHEM"), tables.getString("TABLE_NAME"));
if (tmd.schemaName() == null) {
tableMeta.put(this.userName != null ? this.userName.toUpperCase() : "", tmd);
tableMeta.put(this.userName != null ? this.userName.toUpperCase(Locale.ROOT) : "", tmd);
}
else {
tableMeta.put(tmd.schemaName().toUpperCase(), tmd);
tableMeta.put(tmd.schemaName().toUpperCase(Locale.ROOT), tmd);
}
}
}
@ -356,7 +357,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
Map<String, TableMetaData> tableMeta) {
if (schemaName != null) {
TableMetaData tmd = tableMeta.get(schemaName.toUpperCase());
TableMetaData tmd = tableMeta.get(schemaName.toUpperCase(Locale.ROOT));
if (tmd == null) {
throw new DataAccessResourceFailureException("Unable to locate table meta-data for '" +
tableName + "' in the '" + schemaName + "' schema");
@ -369,7 +370,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
else {
TableMetaData tmd = tableMeta.get(getDefaultSchema());
if (tmd == null) {
tmd = tableMeta.get(this.userName != null ? this.userName.toUpperCase() : "");
tmd = tableMeta.get(this.userName != null ? this.userName.toUpperCase(Locale.ROOT) : "");
}
if (tmd == null) {
tmd = tableMeta.get("PUBLIC");

View File

@ -19,6 +19,7 @@ package org.springframework.jdbc.core.metadata;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -216,11 +217,11 @@ public class TableMetaDataContext {
}
Set<String> keys = CollectionUtils.newLinkedHashSet(generatedKeyNames.length);
for (String key : generatedKeyNames) {
keys.add(key.toUpperCase());
keys.add(key.toUpperCase(Locale.ROOT));
}
List<String> columns = new ArrayList<>();
for (TableParameterMetaData meta : obtainMetaDataProvider().getTableParameterMetaData()) {
if (!keys.contains(meta.getParameterName().toUpperCase())) {
if (!keys.contains(meta.getParameterName().toUpperCase(Locale.ROOT))) {
columns.add(meta.getParameterName());
}
}
@ -242,7 +243,7 @@ public class TableMetaDataContext {
values.add(SqlParameterSourceUtils.getTypedValue(parameterSource, column));
}
else {
String lowerCaseName = column.toLowerCase();
String lowerCaseName = column.toLowerCase(Locale.ROOT);
if (parameterSource.hasValue(lowerCaseName)) {
values.add(SqlParameterSourceUtils.getTypedValue(parameterSource, lowerCaseName));
}
@ -275,7 +276,7 @@ public class TableMetaDataContext {
for (String column : this.tableColumns) {
Object value = inParameters.get(column);
if (value == null) {
value = inParameters.get(column.toLowerCase());
value = inParameters.get(column.toLowerCase(Locale.ROOT));
if (value == null) {
for (Map.Entry<String, ?> entry : inParameters.entrySet()) {
if (column.equalsIgnoreCase(entry.getKey())) {
@ -297,7 +298,7 @@ public class TableMetaDataContext {
public String createInsertString(String... generatedKeyNames) {
Set<String> keys = CollectionUtils.newLinkedHashSet(generatedKeyNames.length);
for (String key : generatedKeyNames) {
keys.add(key.toUpperCase());
keys.add(key.toUpperCase(Locale.ROOT));
}
String identifierQuoteString = (isQuoteIdentifiers() ?
@ -325,7 +326,7 @@ public class TableMetaDataContext {
insertStatement.append(" (");
int columnCount = 0;
for (String columnName : getTableColumns()) {
if (!keys.contains(columnName.toUpperCase())) {
if (!keys.contains(columnName.toUpperCase(Locale.ROOT))) {
columnCount++;
if (columnCount > 1) {
insertStatement.append(", ");
@ -365,7 +366,7 @@ public class TableMetaDataContext {
List<TableParameterMetaData> parameters = obtainMetaDataProvider().getTableParameterMetaData();
Map<String, TableParameterMetaData> parameterMap = CollectionUtils.newLinkedHashMap(parameters.size());
for (TableParameterMetaData tpmd : parameters) {
parameterMap.put(tpmd.getParameterName().toUpperCase(), tpmd);
parameterMap.put(tpmd.getParameterName().toUpperCase(Locale.ROOT), tpmd);
}
int typeIndx = 0;
for (String column : getTableColumns()) {
@ -373,7 +374,7 @@ public class TableMetaDataContext {
types[typeIndx] = SqlTypeValue.TYPE_UNKNOWN;
}
else {
TableParameterMetaData tpmd = parameterMap.get(column.toUpperCase());
TableParameterMetaData tpmd = parameterMap.get(column.toUpperCase(Locale.ROOT));
if (tpmd != null) {
types[typeIndx] = tpmd.getSqlType();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -19,6 +19,7 @@ package org.springframework.jdbc.core.namedparam;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.springframework.jdbc.core.SqlParameterValue;
@ -115,7 +116,7 @@ public abstract class SqlParameterSourceUtils {
String[] paramNames = parameterSource.getParameterNames();
if (paramNames != null) {
for (String name : paramNames) {
caseInsensitiveParameterNames.put(name.toLowerCase(), name);
caseInsensitiveParameterNames.put(name.toLowerCase(Locale.ROOT), name);
}
}
return caseInsensitiveParameterNames;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -26,6 +26,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.sql.DataSource;
@ -490,7 +491,7 @@ public abstract class AbstractJdbcInsert {
// get generated keys feature. HSQL is one, PostgreSQL is another. Postgres uses a RETURNING
// clause while HSQL uses a second query that has to be executed with the same connection.
if (keyQuery.toUpperCase().startsWith("RETURNING")) {
if (keyQuery.toUpperCase(Locale.ROOT).startsWith("RETURNING")) {
Long key = getJdbcTemplate().queryForObject(
getInsertString() + " " + keyQuery, Long.class, values.toArray());
Map<String, Object> keys = new HashMap<>(2);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 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.
@ -16,6 +16,8 @@
package org.springframework.jms.config;
import java.util.Locale;
import jakarta.jms.Session;
import org.w3c.dom.Element;
@ -155,7 +157,7 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
}
}
else {
properties.add("cacheLevelName", "CACHE_" + cache.toUpperCase());
properties.add("cacheLevelName", "CACHE_" + cache.toUpperCase(Locale.ROOT));
}
}

View File

@ -22,6 +22,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -166,7 +167,7 @@ public @interface NestedTestConfiguration {
return null;
}
try {
return EnclosingConfiguration.valueOf(name.trim().toUpperCase());
return EnclosingConfiguration.valueOf(name.trim().toUpperCase(Locale.ROOT));
}
catch (IllegalArgumentException ex) {
Log logger = LogFactory.getLog(EnclosingConfiguration.class);
@ -178,7 +179,6 @@ public @interface NestedTestConfiguration {
return null;
}
}
}
}

View File

@ -22,6 +22,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -161,7 +162,7 @@ public @interface TestConstructor {
return null;
}
try {
return AutowireMode.valueOf(name.trim().toUpperCase());
return AutowireMode.valueOf(name.trim().toUpperCase(Locale.ROOT));
}
catch (IllegalArgumentException ex) {
Log logger = LogFactory.getLog(AutowireMode.class);

View File

@ -18,6 +18,7 @@ package org.springframework.test.context.junit.jupiter;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Locale;
import java.util.Optional;
import java.util.function.Function;
@ -190,7 +191,7 @@ abstract class AbstractExpressionEvaluatingCondition implements ExecutionConditi
return b;
}
else if (result instanceof String str) {
str = str.trim().toLowerCase();
str = str.trim().toLowerCase(Locale.ROOT);
if ("true".equals(str)) {
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@ -19,6 +19,7 @@ package org.springframework.web.socket.client;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@ -81,7 +82,7 @@ public abstract class AbstractWebSocketClient implements WebSocketClient {
HttpHeaders headersToUse = new HttpHeaders();
if (headers != null) {
headers.forEach((header, values) -> {
if (values != null && !specialHeaders.contains(header.toLowerCase())) {
if (values != null && !specialHeaders.contains(header.toLowerCase(Locale.ROOT))) {
headersToUse.put(header, values);
}
});

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.logging.Log;
@ -154,7 +155,7 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life
public void setSupportedProtocols(String... protocols) {
this.supportedProtocols.clear();
for (String protocol : protocols) {
this.supportedProtocols.add(protocol.toLowerCase());
this.supportedProtocols.add(protocol.toLowerCase(Locale.ROOT));
}
}
@ -329,10 +330,10 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life
protected String selectProtocol(List<String> requestedProtocols, WebSocketHandler webSocketHandler) {
List<String> handlerProtocols = determineHandlerSupportedProtocols(webSocketHandler);
for (String protocol : requestedProtocols) {
if (handlerProtocols.contains(protocol.toLowerCase())) {
if (handlerProtocols.contains(protocol.toLowerCase(Locale.ROOT))) {
return protocol;
}
if (this.supportedProtocols.contains(protocol.toLowerCase())) {
if (this.supportedProtocols.contains(protocol.toLowerCase(Locale.ROOT))) {
return protocol;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -16,6 +16,8 @@
package org.springframework.web.socket.sockjs.frame;
import java.util.Locale;
import org.springframework.util.Assert;
/**
@ -58,7 +60,7 @@ public abstract class AbstractSockJsMessageCodec implements SockJsMessageCodec {
for (char c : characters) {
if (isSockJsSpecialChar(c)) {
result.append('\\').append('u');
String hex = Integer.toHexString(c).toLowerCase();
String hex = Integer.toHexString(c).toLowerCase(Locale.ROOT);
result.append("0".repeat(Math.max(0, (4 - hex.length()))));
result.append(hex);
}