Use Locale.ROOT consistently for toLower/toUpperCase
Closes gh-33708
This commit is contained in:
@@ -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.
|
||||
@@ -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;
|
||||
|
||||
@@ -192,7 +193,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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user