Skip to content

Commit 306c79f

Browse files
committed
Merge branch '1.5.x'
2 parents 219b2d8 + b4a7e1d commit 306c79f

File tree

25 files changed

+82
-45
lines changed

25 files changed

+82
-45
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
1818

19+
import java.util.Locale;
20+
1921
import org.apache.commons.logging.Log;
2022
import org.apache.commons.logging.LogFactory;
2123
import reactor.core.publisher.Mono;
@@ -110,7 +112,7 @@ private Token getToken(ServerHttpRequest request) {
110112
String authorization = request.getHeaders().getFirst("Authorization");
111113
String bearerPrefix = "bearer ";
112114
if (authorization == null
113-
|| !authorization.toLowerCase().startsWith(bearerPrefix)) {
115+
|| !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) {
114116
throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION,
115117
"Authorization header is missing or invalid");
116118
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptor.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet;
1818

19+
import java.util.Locale;
20+
1921
import javax.servlet.http.HttpServletRequest;
2022

2123
import org.apache.commons.logging.Log;
@@ -104,7 +106,7 @@ private Token getToken(HttpServletRequest request) {
104106
String authorization = request.getHeader("Authorization");
105107
String bearerPrefix = "bearer ";
106108
if (authorization == null
107-
|| !authorization.toLowerCase().startsWith(bearerPrefix)) {
109+
|| !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) {
108110
throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION,
109111
"Authorization header is missing or invalid");
110112
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Collection;
2222
import java.util.Collections;
2323
import java.util.HashSet;
24+
import java.util.Locale;
2425
import java.util.Set;
2526
import java.util.stream.Collectors;
2627

@@ -81,7 +82,7 @@ private Set<String> asSet(Collection<String> items) {
8182
if (items == null) {
8283
return Collections.emptySet();
8384
}
84-
return items.stream().map(String::toLowerCase)
85+
return items.stream().map(item -> item.toLowerCase(Locale.ENGLISH))
8586
.collect(Collectors.toCollection(HashSet::new));
8687
}
8788

@@ -109,7 +110,7 @@ private boolean isExcluded(ExposableEndpoint<?> endpoint) {
109110
}
110111

111112
private boolean contains(Set<String> items, ExposableEndpoint<?> endpoint) {
112-
return items.contains(endpoint.getId().toLowerCase());
113+
return items.contains(endpoint.getId().toLowerCase(Locale.ENGLISH));
113114
}
114115

115116
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.actuate.endpoint.invoke.reflect;
1818

1919
import java.lang.reflect.Method;
20+
import java.util.Locale;
2021

2122
import org.springframework.boot.actuate.endpoint.OperationType;
2223
import org.springframework.boot.actuate.endpoint.invoke.OperationParameters;
@@ -81,8 +82,8 @@ public OperationParameters getParameters() {
8182

8283
@Override
8384
public String toString() {
84-
return "Operation " + this.operationType.name().toLowerCase() + " method "
85-
+ this.method;
85+
return "Operation " + this.operationType.name().toLowerCase(Locale.ENGLISH)
86+
+ " method " + this.method;
8687
}
8788

8889
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorNameFactory.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 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,7 @@
1616

1717
package org.springframework.boot.actuate.health;
1818

19+
import java.util.Locale;
1920
import java.util.function.Function;
2021

2122
/**
@@ -28,7 +29,7 @@ public class HealthIndicatorNameFactory implements Function<String, String> {
2829

2930
@Override
3031
public String apply(String name) {
31-
int index = name.toLowerCase().indexOf("healthindicator");
32+
int index = name.toLowerCase(Locale.ENGLISH).indexOf("healthindicator");
3233
if (index > 0) {
3334
return name.substring(0, index);
3435
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.HashSet;
2626
import java.util.LinkedHashSet;
2727
import java.util.List;
28+
import java.util.Locale;
2829
import java.util.Map;
2930
import java.util.Set;
3031

@@ -479,7 +480,7 @@ public String toString() {
479480
string.append(StringUtils.collectionToCommaDelimitedString(this.types));
480481
}
481482
string.append("; SearchStrategy: ");
482-
string.append(this.strategy.toString().toLowerCase());
483+
string.append(this.strategy.toString().toLowerCase(Locale.ENGLISH));
483484
string.append(")");
484485
return string.toString();
485486
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.ArrayList;
2020
import java.util.Arrays;
2121
import java.util.List;
22+
import java.util.Locale;
2223

2324
import javax.annotation.PostConstruct;
2425

@@ -252,7 +253,8 @@ public void checkSessionRepository() {
252253
throw new SessionRepositoryUnavailableException("No session "
253254
+ "repository could be auto-configured, check your "
254255
+ "configuration (session store type is '"
255-
+ storeType.name().toLowerCase() + "')", storeType);
256+
+ storeType.name().toLowerCase(Locale.ENGLISH)
257+
+ "')", storeType);
256258
}
257259
}
258260
}

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.ArrayList;
2828
import java.util.Arrays;
2929
import java.util.List;
30+
import java.util.Locale;
3031
import java.util.jar.Manifest;
3132

3233
import groovy.lang.Grab;
@@ -127,9 +128,10 @@ protected ExitStatus run(OptionSet options) throws Exception {
127128
+ this.type + " and at least one source file must be specified");
128129

129130
File output = new File((String) nonOptionArguments.remove(0));
130-
Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type),
131-
"The output '" + output + "' is not a " + this.type.toUpperCase()
132-
+ " file.");
131+
Assert.isTrue(
132+
output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type),
133+
"The output '" + output + "' is not a " + this.type.toUpperCase(
134+
Locale.ENGLISH) + " file.");
133135
deleteIfExists(output);
134136

135137
GroovyCompiler compiler = createCompiler(options);

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 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.
@@ -23,6 +23,7 @@
2323
import java.util.HashSet;
2424
import java.util.LinkedHashMap;
2525
import java.util.List;
26+
import java.util.Locale;
2627
import java.util.Map;
2728
import java.util.Set;
2829
import java.util.regex.Matcher;
@@ -158,7 +159,7 @@ private String toKebabCase(String name) {
158159
matcher.group(1) + '-' + StringUtils.uncapitalize(matcher.group(2)));
159160
}
160161
matcher.appendTail(result);
161-
return result.toString().toLowerCase();
162+
return result.toString().toLowerCase(Locale.ENGLISH);
162163
}
163164

164165
private String dotAppend(String prefix, String postfix) {

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.ArrayList;
2424
import java.util.Iterator;
2525
import java.util.List;
26+
import java.util.Locale;
2627

2728
import org.json.JSONArray;
2829
import org.json.JSONObject;
@@ -183,7 +184,7 @@ private Deprecation parseDeprecation(JSONObject object) throws Exception {
183184
private Deprecation.Level parseDeprecationLevel(String value) {
184185
if (value != null) {
185186
try {
186-
return Deprecation.Level.valueOf(value.toUpperCase());
187+
return Deprecation.Level.valueOf(value.toUpperCase(Locale.ENGLISH));
187188
}
188189
catch (IllegalArgumentException e) {
189190
// let's use the default

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 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.
@@ -19,6 +19,7 @@
1919
import java.io.File;
2020
import java.util.Collections;
2121
import java.util.HashMap;
22+
import java.util.Locale;
2223
import java.util.Map;
2324

2425
/**
@@ -42,7 +43,7 @@ public static Layout forFile(File file) {
4243
if (file == null) {
4344
throw new IllegalArgumentException("File must not be null");
4445
}
45-
String lowerCaseFileName = file.getName().toLowerCase();
46+
String lowerCaseFileName = file.getName().toLowerCase(Locale.ENGLISH);
4647
if (lowerCaseFileName.endsWith(".jar")) {
4748
return new Jar();
4849
}

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 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.
@@ -23,6 +23,7 @@
2323
import java.lang.reflect.Method;
2424
import java.util.Arrays;
2525
import java.util.Collection;
26+
import java.util.Locale;
2627

2728
import org.springframework.util.ReflectionUtils;
2829

@@ -123,7 +124,8 @@ private boolean inheritIO(ProcessBuilder builder) {
123124
// There's a bug in the Windows VM (https://bugs.openjdk.java.net/browse/JDK-8023130)
124125
// that means we need to avoid inheritIO
125126
private static boolean isInheritIOBroken() {
126-
if (!System.getProperty("os.name", "none").toLowerCase().contains("windows")) {
127+
if (!System.getProperty("os.name", "none").toLowerCase(Locale.ENGLISH)
128+
.contains("windows")) {
127129
return false;
128130
}
129131
String runtime = System.getProperty("java.runtime.version");

spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Collections;
2828
import java.util.LinkedHashSet;
2929
import java.util.List;
30+
import java.util.Locale;
3031
import java.util.Properties;
3132
import java.util.Set;
3233
import java.util.jar.Manifest;
@@ -488,7 +489,7 @@ private Archive getArchive(File file) throws IOException {
488489
if (isNestedArchivePath(file)) {
489490
return null;
490491
}
491-
String name = file.getName().toLowerCase();
492+
String name = file.getName().toLowerCase(Locale.ENGLISH);
492493
if (name.endsWith(".jar") || name.endsWith(".zip")) {
493494
return new JarFileArchive(file);
494495
}
@@ -564,7 +565,7 @@ private String cleanupPath(String path) {
564565
if (path.startsWith("./")) {
565566
path = path.substring(2);
566567
}
567-
String lowerCasePath = path.toLowerCase();
568+
String lowerCasePath = path.toLowerCase(Locale.ENGLISH);
568569
if (lowerCasePath.endsWith(".jar") || lowerCasePath.endsWith(".zip")) {
569570
return path;
570571
}

spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.loader.util;
1818

1919
import java.util.HashSet;
20+
import java.util.Locale;
2021
import java.util.Properties;
2122
import java.util.Set;
2223

@@ -188,7 +189,8 @@ public static String getProperty(String key, String defaultValue, String text) {
188189
}
189190
if (propVal == null) {
190191
// Try uppercase with underscores as well.
191-
propVal = System.getenv(key.toUpperCase().replace('.', '_'));
192+
propVal = System.getenv(key.toUpperCase(Locale.ENGLISH)
193+
.replace('.', '_'));
192194
}
193195
if (propVal != null) {
194196
return propVal;

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 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
package org.springframework.boot.ansi;
1818

19+
import java.util.Locale;
20+
1921
import org.springframework.util.Assert;
2022

2123
/**
@@ -35,7 +37,7 @@ public abstract class AnsiOutput {
3537
private static Boolean ansiCapable;
3638

3739
private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name")
38-
.toLowerCase();
40+
.toLowerCase(Locale.ENGLISH);
3941

4042
private static final String ENCODE_START = "\033[";
4143

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.ArrayList;
2222
import java.util.Collections;
2323
import java.util.List;
24+
import java.util.Locale;
2425
import java.util.concurrent.atomic.AtomicBoolean;
2526

2627
import org.apache.commons.logging.Log;
@@ -250,7 +251,8 @@ private static class SystemProperty implements Property {
250251
private final String[] properties;
251252

252253
SystemProperty(String name) {
253-
this.properties = new String[] { name.toUpperCase(), name.toLowerCase() };
254+
this.properties = new String[] { name.toUpperCase(Locale.ENGLISH),
255+
name.toLowerCase(Locale.ENGLISH) };
254256
}
255257

256258
@Override

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.Collections;
2020
import java.util.List;
21+
import java.util.Locale;
2122
import java.util.Map;
2223
import java.util.concurrent.atomic.AtomicBoolean;
2324

@@ -321,7 +322,7 @@ private LogLevel coerceLogLevel(String level) {
321322
if ("false".equalsIgnoreCase(level)) {
322323
return LogLevel.OFF;
323324
}
324-
return LogLevel.valueOf(level.toUpperCase());
325+
return LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH));
325326
}
326327

327328
private void registerShutdownHookIfNecessary(Environment environment,

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.context.properties.source;
1818

19+
import java.util.Locale;
20+
1921
import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form;
2022

2123
/**
@@ -76,7 +78,7 @@ private String convertName(ConfigurationPropertyName name, int numberOfElements)
7678
if (result.length() > 0) {
7779
result.append("_");
7880
}
79-
result.append(name.getElement(i, Form.UNIFORM).toUpperCase());
81+
result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH));
8082
}
8183
return result.toString();
8284
}
@@ -93,11 +95,11 @@ private String convertLegacyName(ConfigurationPropertyName name) {
9395
}
9496

9597
private Object convertLegacyNameElement(String element) {
96-
return element.replace('-', '_').toUpperCase();
98+
return element.replace('-', '_').toUpperCase(Locale.ENGLISH);
9799
}
98100

99101
private CharSequence processElementValue(CharSequence value) {
100-
String result = value.toString().toLowerCase();
102+
String result = value.toString().toLowerCase(Locale.ENGLISH);
101103
return (isNumber(result) ? "[" + result + "]" : result);
102104
}
103105

0 commit comments

Comments
 (0)