diff --git a/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java b/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java index 0c33bd276e0c..9a9a7d8f30d1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java +++ b/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java @@ -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 @@ 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 int compare(T o1, T o2) { 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; diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java index f6042bee9347..f01a9162b731 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java @@ -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 @@ import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; +import java.util.Locale; import javax.sql.DataSource; @@ -155,7 +156,7 @@ public void initialize() { 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()); } diff --git a/spring-context/src/main/java/org/springframework/format/datetime/standard/MonthFormatter.java b/spring-context/src/main/java/org/springframework/format/datetime/standard/MonthFormatter.java index abae18df61cb..a6c56fbe9354 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/standard/MonthFormatter.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/standard/MonthFormatter.java @@ -34,7 +34,7 @@ class MonthFormatter implements Formatter { @Override public Month parse(String text, Locale locale) throws ParseException { - return Month.valueOf(text.toUpperCase()); + return Month.valueOf(text.toUpperCase(Locale.ROOT)); } @Override diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java index 3124cc25b5e5..e1702c9a548b 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java @@ -21,6 +21,7 @@ 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 @@ private static CronField parseList(String value, Type type, BiFunction clazz = makeArrayIfNecessary(tc.getType()); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java index 8d2c0d2a3ede..c8c341a54375 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java @@ -21,6 +21,7 @@ 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 @@ private SpelNodeImpl eatPossiblyQualifiedId() { 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 @@ private Token eatToken(TokenKind expectedKind) { } 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 @@ public String toString(@Nullable Token t) { 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) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java index 8d80fc8a3364..379ca5b22250 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java @@ -19,6 +19,7 @@ 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 @@ private void lexIdentifier() { // 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); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java index 6b84ceb1d02e..fdc66aa1c342 100755 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java @@ -385,7 +385,7 @@ protected List reconcileParameters(List parameters) 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 Map matchInParameterValuesWithCallParameters(SqlParameter 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 Map matchInParameterValuesWithCallParameters(SqlParameter 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 @@ else if (logger.isInfoEnabled()) { 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 @@ protected String createParameterBinding(SqlParameter parameter) { } private static String lowerCase(@Nullable String paramName) { - return (paramName != null ? paramName.toLowerCase() : ""); + return (paramName != null ? paramName.toLowerCase(Locale.ROOT) : ""); } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/Db2CallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/Db2CallMetaDataProvider.java index 13904c9f340e..66c49564681c 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/Db2CallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/Db2CallMetaDataProvider.java @@ -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 @@ import java.sql.DatabaseMetaData; import java.sql.SQLException; +import java.util.Locale; import org.springframework.lang.Nullable; @@ -73,7 +74,7 @@ public String metaDataSchemaNameToUse(@Nullable String schemaName) { // 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); } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyCallMetaDataProvider.java index 02bbaa629f23..efaa556cf6b3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyCallMetaDataProvider.java @@ -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 @@ import java.sql.DatabaseMetaData; import java.sql.SQLException; +import java.util.Locale; import org.springframework.lang.Nullable; @@ -45,7 +46,7 @@ public String metaDataSchemaNameToUse(@Nullable String schemaName) { // 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); } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java index 36383fefc578..5eb124b063f6 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java @@ -22,6 +22,7 @@ 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 @@ private String identifierNameToUse(@Nullable String identifierName) { 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; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java index 6269c0d91ae8..b5e65f418b9b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java @@ -24,6 +24,7 @@ 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 @@ private String identifierNameToUse(@Nullable String identifierName) { 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 @@ private void locateTableAndProcessMetaData(DatabaseMetaData databaseMetaData, 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 @@ private TableMetaData findTableMetaData(@Nullable String schemaName, @Nullable S Map 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 @@ else if (tableMeta.size() == 1) { 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"); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java index 577a0093d8e9..5b655509783e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -217,11 +218,11 @@ protected List reconcileColumnsToUse(List declaredColumns, Strin } Set keys = new LinkedHashSet<>(generatedKeyNames.length); for (String key : generatedKeyNames) { - keys.add(key.toUpperCase()); + keys.add(key.toUpperCase(Locale.ROOT)); } List 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()); } } @@ -243,7 +244,7 @@ public List matchInParameterValuesWithInsertColumns(SqlParameterSource p 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)); } @@ -276,7 +277,7 @@ public List matchInParameterValuesWithInsertColumns(Map inPar 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 entry : inParameters.entrySet()) { if (column.equalsIgnoreCase(entry.getKey())) { @@ -298,7 +299,7 @@ public List matchInParameterValuesWithInsertColumns(Map inPar public String createInsertString(String... generatedKeyNames) { Set keys = new LinkedHashSet<>(generatedKeyNames.length); for (String key : generatedKeyNames) { - keys.add(key.toUpperCase()); + keys.add(key.toUpperCase(Locale.ROOT)); } String identifierQuoteString = (isQuoteIdentifiers() ? @@ -326,7 +327,7 @@ public String createInsertString(String... generatedKeyNames) { 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(", "); @@ -366,7 +367,7 @@ public int[] createInsertTypes() { List parameters = obtainMetaDataProvider().getTableParameterMetaData(); Map 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()) { @@ -374,7 +375,7 @@ public int[] createInsertTypes() { 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(); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java index 89b3f832dbab..9709561eb286 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java @@ -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 @@ 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 static Map extractCaseInsensitiveParameterNames(SqlParame 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; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java index 979ae771a56f..6b86dbb67390 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java @@ -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.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 @@ private KeyHolder executeInsertAndReturnKeyHolderInternal(List values) { // 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 keys = new HashMap<>(2); diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java index 39ff7a719a1c..85d075415a9a 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java @@ -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 @@ protected MutablePropertyValues parseSpecificContainerProperties(Element contain } } else { - properties.add("cacheLevelName", "CACHE_" + cache.toUpperCase()); + properties.add("cacheLevelName", "CACHE_" + cache.toUpperCase(Locale.ROOT)); } } diff --git a/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java index 3686560b7a15..c348ef157665 100644 --- a/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/NestedTestConfiguration.java @@ -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. @@ -22,6 +22,7 @@ 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; @@ -159,7 +160,7 @@ public static EnclosingConfiguration from(@Nullable String name) { 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); @@ -171,7 +172,6 @@ public static EnclosingConfiguration from(@Nullable String name) { return null; } } - } } diff --git a/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java b/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java index 74ebda799dd9..8997f455b611 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestConstructor.java @@ -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. @@ -22,6 +22,7 @@ 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 static AutowireMode from(@Nullable String name) { 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);