diff --git a/integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java b/integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java index 2f13da238f4e..31eaf2c83725 100644 --- a/integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java +++ b/integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java @@ -316,7 +316,7 @@ private ApplicationContext createContext(final ScopedProxyMode scopedProxyMode) break; } else if (annDef.getMetadata().getMetaAnnotationTypes(type).contains(javax.inject.Scope.class.getName())) { - metadata.setScopeName(type.substring(type.length() - 13, type.length() - 6).toLowerCase()); + metadata.setScopeName(type.substring(type.length() - 13, type.length() - 6).toLowerCase(Locale.ROOT)); metadata.setScopedProxyMode(scopedProxyMode); break; } 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 519ead579879..f81f8906a75a 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 @@ -77,8 +77,8 @@ public int compare(T o1, T o2) { Object v1 = getPropertyValue(o1); Object v2 = getPropertyValue(o2); if (this.sortDefinition.isIgnoreCase() && (v1 instanceof String) && (v2 instanceof String)) { - v1 = ((String) v1).toLowerCase(); - v2 = ((String) v2).toLowerCase(); + v1 = ((String) v1).toLowerCase(Locale.ROOT); + v2 = ((String) v2).toLowerCase(Locale.ROOT); } int result; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index e51017df5d5b..aeedba55f36d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -277,7 +277,7 @@ public void testPropertyOverrideConfigurerWithInvalidKey() { } catch (BeanInitializationException ex) { // prove that the processor chokes on the invalid key - assertThat(ex.getMessage().toLowerCase().contains("argh")).isTrue(); + assertThat(ex.getMessage().toLowerCase(Locale.ROOT).contains("argh")).isTrue(); } } } 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..e7f25e7484e1 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 @@ -155,7 +155,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/validation/DataBinder.java b/spring-context/src/main/java/org/springframework/validation/DataBinder.java index 8cd4b6ef9c7c..33c30065471a 100644 --- a/spring-context/src/main/java/org/springframework/validation/DataBinder.java +++ b/spring-context/src/main/java/org/springframework/validation/DataBinder.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.apache.commons.logging.Log; @@ -464,7 +465,7 @@ public String[] getAllowedFields() { *

The default implementation of this method stores disallowed field patterns * in {@linkplain PropertyAccessorUtils#canonicalPropertyName(String) canonical} * form. As of Spring Framework 5.2.21, the default implementation also transforms - * disallowed field patterns to {@linkplain String#toLowerCase() lowercase} to + * disallowed field patterns to {@linkplain String#toLowerCase(Locale.ROOT) lowercase} to * support case-insensitive pattern matching in {@link #isAllowed}. Subclasses * which override this method must therefore take both of these transformations * into account. @@ -482,7 +483,8 @@ public void setDisallowedFields(@Nullable String... disallowedFields) { else { String[] fieldPatterns = new String[disallowedFields.length]; for (int i = 0; i < fieldPatterns.length; i++) { - fieldPatterns[i] = PropertyAccessorUtils.canonicalPropertyName(disallowedFields[i]).toLowerCase(); + String field = PropertyAccessorUtils.canonicalPropertyName(disallowedFields[i]); + fieldPatterns[i] = field.toLowerCase(Locale.ROOT); } this.disallowedFields = fieldPatterns; } @@ -825,7 +827,7 @@ protected boolean isAllowed(String field) { String[] allowed = getAllowedFields(); String[] disallowed = getDisallowedFields(); return ((ObjectUtils.isEmpty(allowed) || PatternMatchUtils.simpleMatch(allowed, field)) && - (ObjectUtils.isEmpty(disallowed) || !PatternMatchUtils.simpleMatch(disallowed, field.toLowerCase()))); + (ObjectUtils.isEmpty(disallowed) || !PatternMatchUtils.simpleMatch(disallowed, field.toLowerCase(Locale.ROOT)))); } /** diff --git a/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt b/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt index 265861a273f1..4bfd0ab8370b 100644 --- a/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt +++ b/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt @@ -178,7 +178,7 @@ open class BeanDefinitionDsl internal constructor (private val init: BeanDefinit role: Role? = null) { val customizer = BeanDefinitionCustomizer { bd -> - scope?.let { bd.scope = scope.name.toLowerCase() } + scope?.let { bd.scope = scope.name.toLowerCase(Locale.ROOT) } isLazyInit?.let { bd.isLazyInit = isLazyInit } isPrimary?.let { bd.isPrimary = isPrimary } isAutowireCandidate?.let { bd.isAutowireCandidate = isAutowireCandidate } @@ -221,7 +221,7 @@ open class BeanDefinitionDsl internal constructor (private val init: BeanDefinit crossinline function: BeanSupplierContext.() -> T) { val customizer = BeanDefinitionCustomizer { bd -> - scope?.let { bd.scope = scope.name.toLowerCase() } + scope?.let { bd.scope = scope.name.toLowerCase(Locale.ROOT) } isLazyInit?.let { bd.isLazyInit = isLazyInit } isPrimary?.let { bd.isPrimary = isPrimary } isAutowireCandidate?.let { bd.isAutowireCandidate = isAutowireCandidate } diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java index 4b1c0fd7b2d6..f0c66320e455 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java @@ -55,7 +55,7 @@ public Boolean convert(String source) { if (value.isEmpty()) { return null; } - value = value.toLowerCase(); + value = value.toLowerCase(Locale.ROOT); if (trueValues.contains(value)) { return Boolean.TRUE; } diff --git a/spring-core/src/main/java/org/springframework/util/MimeType.java b/spring-core/src/main/java/org/springframework/util/MimeType.java index eb5a0464aecf..299f1712bfb3 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeType.java +++ b/spring-core/src/main/java/org/springframework/util/MimeType.java @@ -182,10 +182,10 @@ public MimeType(String type, String subtype, @Nullable Map param Assert.hasLength(subtype, "'subtype' must not be empty"); checkToken(type); checkToken(subtype); - this.type = type.toLowerCase(Locale.ENGLISH); - this.subtype = subtype.toLowerCase(Locale.ENGLISH); + this.type = type.toLowerCase(Locale.ROOT); + this.subtype = subtype.toLowerCase(Locale.ROOT); if (!CollectionUtils.isEmpty(parameters)) { - Map map = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ENGLISH); + Map map = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ROOT); parameters.forEach((parameter, value) -> { checkParameters(parameter, value); map.put(parameter, value); diff --git a/spring-core/src/main/java/org/springframework/util/ResourceUtils.java b/spring-core/src/main/java/org/springframework/util/ResourceUtils.java index 2caaf33597f7..52b7ad302ed0 100644 --- a/spring-core/src/main/java/org/springframework/util/ResourceUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ResourceUtils.java @@ -295,7 +295,7 @@ public static boolean isJarURL(URL url) { */ 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)); } /** diff --git a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java index ea08de6df40b..0d07773f6658 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java @@ -2947,7 +2947,7 @@ enum RequestMethod { */ @Override public String toString() { - return "method: " + name().toLowerCase(); + return "method: " + name().toLowerCase(Locale.ROOT); } } 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 cf135d08ed23..47f98793c857 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 @@ -750,7 +750,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 +942,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 +1038,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/test/java/org/springframework/expression/spel/MethodInvocationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java index 722b385f21b1..bcd505c1acea 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java @@ -60,7 +60,7 @@ public void testSimpleAccess01() { public void testStringClass() { evaluate("new java.lang.String('hello').charAt(2)", 'l', Character.class); evaluate("new java.lang.String('hello').charAt(2).equals('l'.charAt(0))", true, Boolean.class); - evaluate("'HELLO'.toLowerCase()", "hello", String.class); + evaluate("'HELLO'.toLowerCase(Locale.ROOT)", "hello", String.class); evaluate("' abcba '.trim()", "abcba", String.class); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java index de5c71d268d0..300efd794df7 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java @@ -3768,7 +3768,7 @@ public void constructorReference_SPR13781() { // The actual expression from the bug report. It fails if the ENGLISH reference fails // to pop the type reference for Locale off the stack (if it isn't popped then - // toLowerCase() will be called with a Locale parameter). In this situation the + // toLowerCase(Locale.ROOT) will be called with a Locale parameter). In this situation the // code generation for ENGLISH should notice there is something on the stack that // is not required and pop it off. expression = parser.parseExpression("#userId.toString().toLowerCase(T(java.util.Locale).ENGLISH)"); 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 2ea0c544ae0e..a6d3e7cd43aa 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); } } } @@ -680,7 +680,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/GenericCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java index 789351ff5eee..bc2872216b7b 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 @@ -282,7 +282,7 @@ else if (isStoresUpperCaseIdentifiers()) { return identifierName.toUpperCase(); } 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 5228cb9b05cd..647f341980a8 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 @@ -233,7 +233,7 @@ else if (isStoresUpperCaseIdentifiers()) { return tableName.toUpperCase(); } else if (isStoresLowerCaseIdentifiers()) { - return tableName.toLowerCase(); + return tableName.toLowerCase(Locale.ROOT); } else { return tableName; @@ -250,7 +250,7 @@ else if (isStoresUpperCaseIdentifiers()) { return catalogName.toUpperCase(); } else if (isStoresLowerCaseIdentifiers()) { - return catalogName.toLowerCase(); + return catalogName.toLowerCase(Locale.ROOT); } else { return catalogName; @@ -267,7 +267,7 @@ else if (isStoresUpperCaseIdentifiers()) { return schemaName.toUpperCase(); } else if (isStoresLowerCaseIdentifiers()) { - return schemaName.toLowerCase(); + return schemaName.toLowerCase(Locale.ROOT); } else { return schemaName; 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 be0ef871bc40..0007032b0aa9 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 @@ -218,7 +218,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)); } @@ -251,7 +251,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())) { 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 ced04936cfa0..946117916899 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 @@ -115,7 +115,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-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java index c004e675ea1e..da8776ff9277 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java @@ -190,7 +190,7 @@ public void modifyCustomNativeHeader() { StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SUBSCRIBE, extHeaders); String accountId = headers.getFirstNativeHeader("accountId"); - headers.setNativeHeader("accountId", accountId.toLowerCase()); + headers.setNativeHeader("accountId", accountId.toLowerCase(Locale.ROOT)); Map> actual = headers.toNativeHeaderMap(); assertThat(actual.size()).isEqualTo(3); diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java index 7d3981f5320d..4c44de2a18cc 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java @@ -406,7 +406,8 @@ public void setCharacterEncoding(@Nullable String characterEncoding) { private void updateContentTypeHeader() { if (StringUtils.hasLength(this.contentType)) { String value = this.contentType; - if (StringUtils.hasLength(this.characterEncoding) && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) { + if (StringUtils.hasLength(this.characterEncoding) && + !this.contentType.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) { value += ';' + CHARSET_PREFIX + this.characterEncoding; } doAddHeaderValue(HttpHeaders.CONTENT_TYPE, value, true); @@ -484,7 +485,7 @@ public void setContentType(@Nullable String contentType) { } catch (IllegalArgumentException ex) { // Try to get charset value anyway - int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); + int charsetIndex = contentType.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX); if (charsetIndex != -1) { this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); } diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java index caeddbb69da3..219e9249a830 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -215,7 +215,7 @@ private void setExplicitCharacterEncoding(String characterEncoding) { private void updateContentTypePropertyAndHeader() { if (this.contentType != null) { String value = this.contentType; - if (this.characterEncodingSet && !value.toLowerCase().contains(CHARSET_PREFIX)) { + if (this.characterEncodingSet && !value.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) { value += ';' + CHARSET_PREFIX + getCharacterEncoding(); this.contentType = value; } @@ -315,7 +315,7 @@ public void setContentType(@Nullable String contentType) { } catch (Exception ex) { // Try to get charset value anyway - int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); + int charsetIndex = contentType.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX); if (charsetIndex != -1) { setExplicitCharacterEncoding(contentType.substring(charsetIndex + CHARSET_PREFIX.length())); } diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/AbstractExpressionEvaluatingCondition.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/AbstractExpressionEvaluatingCondition.java index 22a9cfa8e332..2b3f299f0ee7 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/AbstractExpressionEvaluatingCondition.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/AbstractExpressionEvaluatingCondition.java @@ -49,7 +49,7 @@ * *