Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23656ae

Browse files
committed
Use Locale.ROOT consistently for toLower/toUpperCase
Seegh-33708
1 parentfeb6a5f commit23656ae

File tree

43 files changed

+106
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+106
-82
lines changed

‎framework-docs/src/main/java/org/springframework/docs/integration/observability/config/conventions/CustomServerRequestObservationConvention.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
1616

1717
packageorg.springframework.docs.integration.observability.config.conventions;
1818

19+
importjava.util.Locale;
20+
1921
importio.micrometer.common.KeyValue;
2022
importio.micrometer.common.KeyValues;
2123

@@ -34,7 +36,7 @@ public String getName() {
3436
@Override
3537
publicStringgetContextualName(ServerRequestObservationContextcontext) {
3638
// will be used for the trace name
37-
return"http " +context.getCarrier().getMethod().toLowerCase();
39+
return"http " +context.getCarrier().getMethod().toLowerCase(Locale.ROOT);
3840
}
3941

4042
@Override

‎spring-context/src/main/java/org/springframework/validation/DataBinder.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
importjava.util.HashMap;
2828
importjava.util.HashSet;
2929
importjava.util.List;
30+
importjava.util.Locale;
3031
importjava.util.Map;
3132
importjava.util.Optional;
3233
importjava.util.Set;
@@ -568,7 +569,8 @@ public void setDisallowedFields(@Nullable String... disallowedFields) {
568569
else {
569570
String[]fieldPatterns =newString[disallowedFields.length];
570571
for (inti =0;i <fieldPatterns.length;i++) {
571-
fieldPatterns[i] =PropertyAccessorUtils.canonicalPropertyName(disallowedFields[i]).toLowerCase();
572+
Stringfield =PropertyAccessorUtils.canonicalPropertyName(disallowedFields[i]);
573+
fieldPatterns[i] =field.toLowerCase(Locale.ROOT);
572574
}
573575
this.disallowedFields =fieldPatterns;
574576
}
@@ -1157,7 +1159,7 @@ protected boolean isAllowed(String field) {
11571159
String[]allowed =getAllowedFields();
11581160
String[]disallowed =getDisallowedFields();
11591161
return ((ObjectUtils.isEmpty(allowed) ||PatternMatchUtils.simpleMatch(allowed,field)) &&
1160-
(ObjectUtils.isEmpty(disallowed) || !PatternMatchUtils.simpleMatch(disallowed,field.toLowerCase())));
1162+
(ObjectUtils.isEmpty(disallowed) || !PatternMatchUtils.simpleMatch(disallowed,field.toLowerCase(Locale.ROOT))));
11611163
}
11621164

11631165
/**

‎spring-core/src/main/java/org/springframework/util/MimeType.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,10 +181,10 @@ public MimeType(String type, String subtype, @Nullable Map<String, String> param
181181
Assert.hasLength(subtype,"'subtype' must not be empty");
182182
checkToken(type);
183183
checkToken(subtype);
184-
this.type =type.toLowerCase(Locale.ENGLISH);
185-
this.subtype =subtype.toLowerCase(Locale.ENGLISH);
184+
this.type =type.toLowerCase(Locale.ROOT);
185+
this.subtype =subtype.toLowerCase(Locale.ROOT);
186186
if (!CollectionUtils.isEmpty(parameters)) {
187-
Map<String,String>map =newLinkedCaseInsensitiveMap<>(parameters.size(),Locale.ENGLISH);
187+
Map<String,String>map =newLinkedCaseInsensitiveMap<>(parameters.size(),Locale.ROOT);
188188
parameters.forEach((parameter,value) -> {
189189
checkParameters(parameter,value);
190190
map.put(parameter,value);

‎spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ public void setCharacterEncoding(@Nullable String characterEncoding) {
409409
privatevoidupdateContentTypeHeader() {
410410
if (StringUtils.hasLength(this.contentType)) {
411411
Stringvalue =this.contentType;
412-
if (StringUtils.hasLength(this.characterEncoding) && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) {
412+
if (StringUtils.hasLength(this.characterEncoding) &&
413+
!this.contentType.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) {
413414
value +=';' +CHARSET_PREFIX +this.characterEncoding;
414415
}
415416
doAddHeaderValue(HttpHeaders.CONTENT_TYPE,value,true);
@@ -487,7 +488,7 @@ public void setContentType(@Nullable String contentType) {
487488
}
488489
catch (IllegalArgumentExceptionex) {
489490
// Try to get charset value anyway
490-
contentType =contentType.toLowerCase();
491+
contentType =contentType.toLowerCase(Locale.ROOT);
491492
intcharsetIndex =contentType.indexOf(CHARSET_PREFIX);
492493
if (charsetIndex != -1) {
493494
this.characterEncoding =contentType.substring(charsetIndex +CHARSET_PREFIX.length());

‎spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private void setExplicitCharacterEncoding(@Nullable String characterEncoding) {
223223
}
224224
catch (Exceptionignored) {
225225
Stringvalue =this.contentType;
226-
intcharsetIndex =value.toLowerCase().indexOf(CHARSET_PREFIX);
226+
intcharsetIndex =value.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX);
227227
if (charsetIndex != -1) {
228228
value =value.substring(0,charsetIndex).trim();
229229
if (value.endsWith(";")) {
@@ -243,7 +243,7 @@ private void setExplicitCharacterEncoding(@Nullable String characterEncoding) {
243243
privatevoidupdateContentTypePropertyAndHeader() {
244244
if (this.contentType !=null) {
245245
Stringvalue =this.contentType;
246-
if (this.characterEncodingSet && !value.toLowerCase().contains(CHARSET_PREFIX)) {
246+
if (this.characterEncodingSet && !value.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) {
247247
value +=';' +CHARSET_PREFIX +getCharacterEncoding();
248248
this.contentType =value;
249249
}
@@ -351,7 +351,7 @@ public void setContentType(@Nullable String contentType) {
351351
}
352352
catch (Exceptionex) {
353353
// Try to get charset value anyway
354-
intcharsetIndex =contentType.toLowerCase().indexOf(CHARSET_PREFIX);
354+
intcharsetIndex =contentType.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX);
355355
if (charsetIndex != -1) {
356356
setExplicitCharacterEncoding(contentType.substring(charsetIndex +CHARSET_PREFIX.length()));
357357
}

‎spring-web/src/main/java/org/springframework/http/HttpHeaders.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
392392
*/
393393
publicstaticfinalHttpHeadersEMPTY =newReadOnlyHttpHeaders(newLinkedMultiValueMap<>());
394394

395-
privatestaticfinalDecimalFormatSymbolsDECIMAL_FORMAT_SYMBOLS =newDecimalFormatSymbols(Locale.ENGLISH);
395+
privatestaticfinalDecimalFormatSymbolsDECIMAL_FORMAT_SYMBOLS =newDecimalFormatSymbols(Locale.ROOT);
396396

397397
privatestaticfinalZoneIdGMT =ZoneId.of("GMT");
398398

@@ -422,7 +422,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
422422
* <p>This is the common constructor, using a case-insensitive map structure.
423423
*/
424424
publicHttpHeaders() {
425-
this(CollectionUtils.toMultiValueMap(newLinkedCaseInsensitiveMap<>(8,Locale.ENGLISH)));
425+
this(CollectionUtils.toMultiValueMap(newLinkedCaseInsensitiveMap<>(8,Locale.ROOT)));
426426
}
427427

428428
/**
@@ -697,7 +697,7 @@ public HttpMethod getAccessControlRequestMethod() {
697697
publicvoidsetAcceptCharset(List<Charset>acceptableCharsets) {
698698
StringJoinerjoiner =newStringJoiner(", ");
699699
for (Charsetcharset :acceptableCharsets) {
700-
joiner.add(charset.name().toLowerCase(Locale.ENGLISH));
700+
joiner.add(charset.name().toLowerCase(Locale.ROOT));
701701
}
702702
set(ACCEPT_CHARSET,joiner.toString());
703703
}

‎spring-web/src/main/java/org/springframework/http/MediaTypeFactory.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ private static MultiValueMap<String, MediaType> parseMimeTypes() {
7777
String[]tokens =StringUtils.tokenizeToStringArray(line,"\t\n\r\f");
7878
MediaTypemediaType =MediaType.parseMediaType(tokens[0]);
7979
for (inti =1;i <tokens.length;i++) {
80-
StringfileExtension =tokens[i].toLowerCase(Locale.ENGLISH);
80+
StringfileExtension =tokens[i].toLowerCase(Locale.ROOT);
8181
result.add(fileExtension,mediaType);
8282
}
8383
}
@@ -117,7 +117,7 @@ public static List<MediaType> getMediaTypes(@Nullable String filename) {
117117
List<MediaType>mediaTypes =null;
118118
Stringext =StringUtils.getFilenameExtension(filename);
119119
if (ext !=null) {
120-
mediaTypes =fileExtensionToMediaTypes.get(ext.toLowerCase(Locale.ENGLISH));
120+
mediaTypes =fileExtensionToMediaTypes.get(ext.toLowerCase(Locale.ROOT));
121121
}
122122
return (mediaTypes !=null ?mediaTypes :Collections.emptyList());
123123
}

‎spring-web/src/main/java/org/springframework/http/client/JdkClientHttpRequest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
importjava.nio.ByteBuffer;
2727
importjava.time.Duration;
2828
importjava.util.Collections;
29+
importjava.util.Locale;
2930
importjava.util.Set;
3031
importjava.util.TreeSet;
3132
importjava.util.concurrent.ExecutionException;
@@ -139,7 +140,7 @@ private HttpRequest buildRequest(HttpHeaders headers, @Nullable Body body) {
139140
}
140141

141142
headers.forEach((headerName,headerValues) -> {
142-
if (!DISALLOWED_HEADERS.contains(headerName.toLowerCase())) {
143+
if (!DISALLOWED_HEADERS.contains(headerName.toLowerCase(Locale.ROOT))) {
143144
for (StringheaderValue :headerValues) {
144145
builder.header(headerName,headerValue);
145146
}

‎spring-web/src/main/java/org/springframework/http/client/JdkClientHttpResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public JdkClientHttpResponse(HttpResponse<InputStream> response) {
5757

5858
privatestaticHttpHeadersadaptHeaders(HttpResponse<?>response) {
5959
Map<String,List<String>>rawHeaders =response.headers().map();
60-
Map<String,List<String>>map =newLinkedCaseInsensitiveMap<>(rawHeaders.size(),Locale.ENGLISH);
60+
Map<String,List<String>>map =newLinkedCaseInsensitiveMap<>(rawHeaders.size(),Locale.ROOT);
6161
MultiValueMap<String,String>multiValueMap =CollectionUtils.toMultiValueMap(map);
6262
multiValueMap.putAll(rawHeaders);
6363
returnHttpHeaders.readOnlyHttpHeaders(multiValueMap);

‎spring-web/src/main/java/org/springframework/http/client/observation/DefaultClientRequestObservationConvention.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
packageorg.springframework.http.client.observation;
1818

1919
importjava.io.IOException;
20+
importjava.util.Locale;
2021
importjava.util.regex.Pattern;
2122

2223
importio.micrometer.common.KeyValue;
@@ -89,7 +90,7 @@ public String getName() {
8990
@Nullable
9091
publicStringgetContextualName(ClientRequestObservationContextcontext) {
9192
ClientHttpRequestrequest =context.getCarrier();
92-
return (request !=null ?"http " +request.getMethod().name().toLowerCase() :null);
93+
return (request !=null ?"http " +request.getMethod().name().toLowerCase(Locale.ROOT) :null);
9394
}
9495

9596
@Override

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp