diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java index 73c0b00a01..760b669090 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive; +import java.util.Locale; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Mono; @@ -110,7 +112,7 @@ class CloudFoundrySecurityInterceptor { String authorization = request.getHeaders().getFirst("Authorization"); String bearerPrefix = "bearer "; if (authorization == null - || !authorization.toLowerCase().startsWith(bearerPrefix)) { + || !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) { throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION, "Authorization header is missing or invalid"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptor.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptor.java index 9e3a9f6f26..d040302b05 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptor.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptor.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet; +import java.util.Locale; + import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; @@ -104,7 +106,7 @@ class CloudFoundrySecurityInterceptor { String authorization = request.getHeader("Authorization"); String bearerPrefix = "bearer "; if (authorization == null - || !authorization.toLowerCase().startsWith(bearerPrefix)) { + || !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) { throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION, "Authorization header is missing or invalid"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java index b834c4208b..4f6f9620c0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import java.util.stream.Collectors; @@ -81,7 +82,7 @@ public class ExposeExcludePropertyEndpointFilter> if (items == null) { return Collections.emptySet(); } - return items.stream().map(String::toLowerCase) + return items.stream().map(item -> item.toLowerCase(Locale.ENGLISH)) .collect(Collectors.toCollection(HashSet::new)); } @@ -109,7 +110,7 @@ public class ExposeExcludePropertyEndpointFilter> } private boolean contains(Set items, ExposableEndpoint endpoint) { - return items.contains(endpoint.getId().toLowerCase()); + return items.contains(endpoint.getId().toLowerCase(Locale.ENGLISH)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java index f73a60444d..8d12cda635 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethod.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.endpoint.invoke.reflect; import java.lang.reflect.Method; +import java.util.Locale; import org.springframework.boot.actuate.endpoint.OperationType; import org.springframework.boot.actuate.endpoint.invoke.OperationParameters; @@ -81,8 +82,8 @@ public class OperationMethod { @Override public String toString() { - return "Operation " + this.operationType.name().toLowerCase() + " method " - + this.method; + return "Operation " + this.operationType.name().toLowerCase(Locale.ENGLISH) + + " method " + this.method; } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorNameFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorNameFactory.java index 5c31b5a9b4..d7a8e48b60 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorNameFactory.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorNameFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 @@ package org.springframework.boot.actuate.health; +import java.util.Locale; import java.util.function.Function; /** @@ -28,7 +29,7 @@ public class HealthIndicatorNameFactory implements Function { @Override public String apply(String name) { - int index = name.toLowerCase().indexOf("healthindicator"); + int index = name.toLowerCase(Locale.ENGLISH).indexOf("healthindicator"); if (index > 0) { return name.substring(0, index); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index cb934c24dd..9d80ae694d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -479,7 +480,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit string.append(StringUtils.collectionToCommaDelimitedString(this.types)); } string.append("; SearchStrategy: "); - string.append(this.strategy.toString().toLowerCase()); + string.append(this.strategy.toString().toLowerCase(Locale.ENGLISH)); string.append(")"); return string.toString(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java index a1cf193045..7edbfe2cbe 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java @@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.session; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import javax.annotation.PostConstruct; @@ -252,7 +253,8 @@ public class SessionAutoConfiguration { throw new SessionRepositoryUnavailableException("No session " + "repository could be auto-configured, check your " + "configuration (session store type is '" - + storeType.name().toLowerCase() + "')", storeType); + + storeType.name().toLowerCase(Locale.ENGLISH) + + "')", storeType); } } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index 78058c4fd1..1b2c2faabc 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java @@ -27,6 +27,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.jar.Manifest; import groovy.lang.Grab; @@ -127,9 +128,10 @@ abstract class ArchiveCommand extends OptionParsingCommand { + this.type + " and at least one source file must be specified"); File output = new File((String) nonOptionArguments.remove(0)); - Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type), - "The output '" + output + "' is not a " + this.type.toUpperCase() - + " file."); + Assert.isTrue( + output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type), + "The output '" + output + "' is not a " + this.type.toUpperCase( + Locale.ENGLISH) + " file."); deleteIfExists(output); GroovyCompiler compiler = createCompiler(options); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java index 29df05fad0..4160bdd3f8 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; @@ -158,7 +159,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource matcher.group(1) + '-' + StringUtils.uncapitalize(matcher.group(2))); } matcher.appendTail(result); - return result.toString().toLowerCase(); + return result.toString().toLowerCase(Locale.ENGLISH); } private String dotAppend(String prefix, String postfix) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java index ae445d2ebf..af12d04743 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java @@ -23,6 +23,7 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.json.JSONArray; import org.json.JSONObject; @@ -183,7 +184,7 @@ class JsonReader { private Deprecation.Level parseDeprecationLevel(String value) { if (value != null) { try { - return Deprecation.Level.valueOf(value.toUpperCase()); + return Deprecation.Level.valueOf(value.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { // let's use the default diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index e2d1a9c610..2aa5ef6113 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.boot.loader.tools; import java.io.File; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; /** @@ -42,7 +43,7 @@ public final class Layouts { if (file == null) { throw new IllegalArgumentException("File must not be null"); } - String lowerCaseFileName = file.getName().toLowerCase(); + String lowerCaseFileName = file.getName().toLowerCase(Locale.ENGLISH); if (lowerCaseFileName.endsWith(".jar")) { return new Jar(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java index e3ef7bcc96..0b1b41eaf4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.io.InputStreamReader; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; +import java.util.Locale; import org.springframework.util.ReflectionUtils; @@ -123,7 +124,8 @@ public class RunProcess { // There's a bug in the Windows VM (https://bugs.openjdk.java.net/browse/JDK-8023130) // that means we need to avoid inheritIO private static boolean isInheritIOBroken() { - if (!System.getProperty("os.name", "none").toLowerCase().contains("windows")) { + if (!System.getProperty("os.name", "none").toLowerCase(Locale.ENGLISH) + .contains("windows")) { return false; } String runtime = System.getProperty("java.runtime.version"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index 0ce60783fe..b96b24b77b 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Properties; import java.util.Set; import java.util.jar.Manifest; @@ -488,7 +489,7 @@ public class PropertiesLauncher extends Launcher { if (isNestedArchivePath(file)) { return null; } - String name = file.getName().toLowerCase(); + String name = file.getName().toLowerCase(Locale.ENGLISH); if (name.endsWith(".jar") || name.endsWith(".zip")) { return new JarFileArchive(file); } @@ -564,7 +565,7 @@ public class PropertiesLauncher extends Launcher { if (path.startsWith("./")) { path = path.substring(2); } - String lowerCasePath = path.toLowerCase(); + String lowerCasePath = path.toLowerCase(Locale.ENGLISH); if (lowerCasePath.endsWith(".jar") || lowerCasePath.endsWith(".zip")) { return path; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index d16bc34c92..3dd2b4ea59 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java @@ -17,6 +17,7 @@ package org.springframework.boot.loader.util; import java.util.HashSet; +import java.util.Locale; import java.util.Properties; import java.util.Set; @@ -188,7 +189,8 @@ public abstract class SystemPropertyUtils { } if (propVal == null) { // Try uppercase with underscores as well. - propVal = System.getenv(key.toUpperCase().replace('.', '_')); + propVal = System.getenv(key.toUpperCase(Locale.ENGLISH) + .replace('.', '_')); } if (propVal != null) { return propVal; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java index ec487ebc44..1c9c7c9cdf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.boot.ansi; +import java.util.Locale; + import org.springframework.util.Assert; /** @@ -35,7 +37,7 @@ public abstract class AnsiOutput { private static Boolean ansiCapable; private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name") - .toLowerCase(); + .toLowerCase(Locale.ENGLISH); private static final String ENCODE_START = "\033["; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java index b83e3b5631..a5e9187bba 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; @@ -250,7 +251,8 @@ public class ApplicationPidFileWriter private final String[] properties; SystemProperty(String name) { - this.properties = new String[] { name.toUpperCase(), name.toLowerCase() }; + this.properties = new String[] { name.toUpperCase(Locale.ENGLISH), + name.toLowerCase(Locale.ENGLISH) }; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java index aeab13099e..15d512e663 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java @@ -18,6 +18,7 @@ package org.springframework.boot.context.logging; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; @@ -321,7 +322,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { if ("false".equalsIgnoreCase(level)) { return LogLevel.OFF; } - return LogLevel.valueOf(level.toUpperCase()); + return LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } private void registerShutdownHookIfNecessary(Environment environment, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java index 2b3faa4c07..85ea9b75ff 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java @@ -16,6 +16,8 @@ package org.springframework.boot.context.properties.source; +import java.util.Locale; + import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form; /** @@ -76,7 +78,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { if (result.length() > 0) { result.append("_"); } - result.append(name.getElement(i, Form.UNIFORM).toUpperCase()); + result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH)); } return result.toString(); } @@ -93,11 +95,11 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { } private Object convertLegacyNameElement(String element) { - return element.replace('-', '_').toUpperCase(); + return element.replace('-', '_').toUpperCase(Locale.ENGLISH); } private CharSequence processElementValue(CharSequence value) { - String result = value.toString().toLowerCase(); + String result = value.toString().toLowerCase(Locale.ENGLISH); return (isNumber(result) ? "[" + result + "]" : result); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index adf4984548..1c868f4919 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -19,6 +19,7 @@ package org.springframework.boot.jdbc; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.Locale; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -133,7 +134,7 @@ public enum DatabaseDriver { @Override protected boolean matchProductName(String productName) { return super.matchProductName(productName) - || productName.toLowerCase().startsWith("firebird"); + || productName.toLowerCase(Locale.ENGLISH).startsWith("firebird"); } }, @@ -146,7 +147,7 @@ public enum DatabaseDriver { @Override protected boolean matchProductName(String productName) { return super.matchProductName(productName) - || productName.toLowerCase().startsWith("db2/"); + || productName.toLowerCase(Locale.ENGLISH).startsWith("db2/"); } }, @@ -170,7 +171,7 @@ public enum DatabaseDriver { @Override protected boolean matchProductName(String productName) { return super.matchProductName(productName) - || productName.toLowerCase().contains("as/400"); + || productName.toLowerCase(Locale.ENGLISH).contains("as/400"); } }, @@ -222,7 +223,7 @@ public enum DatabaseDriver { * @return the identifier */ public String getId() { - return name().toLowerCase(); + return name().toLowerCase(Locale.ENGLISH); } protected boolean matchProductName(String productName) { @@ -230,7 +231,7 @@ public enum DatabaseDriver { } protected Collection getUrlPrefixes() { - return Collections.singleton(this.name().toLowerCase()); + return Collections.singleton(this.name().toLowerCase(Locale.ENGLISH)); } /** @@ -265,7 +266,8 @@ public enum DatabaseDriver { public static DatabaseDriver fromJdbcUrl(String url) { if (StringUtils.hasLength(url)) { Assert.isTrue(url.startsWith("jdbc"), "URL must start with 'jdbc'"); - String urlWithoutPrefix = url.substring("jdbc".length()).toLowerCase(); + String urlWithoutPrefix = url.substring("jdbc".length()) + .toLowerCase(Locale.ENGLISH); for (DatabaseDriver driver : values()) { for (String urlPrefix : driver.getUrlPrefixes()) { String prefix = ":" + urlPrefix + ":"; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java index 6232eec5f7..15b8743480 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java @@ -18,6 +18,7 @@ package org.springframework.boot.jdbc; import java.sql.Connection; import java.sql.SQLException; +import java.util.Locale; import javax.sql.DataSource; @@ -155,7 +156,7 @@ public enum EmbeddedDatabaseConnection { if (productName == null) { return false; } - productName = productName.toUpperCase(); + productName = productName.toUpperCase(Locale.ENGLISH); EmbeddedDatabaseConnection[] candidates = EmbeddedDatabaseConnection.values(); for (EmbeddedDatabaseConnection candidate : candidates) { if (candidate != NONE && productName.contains(candidate.name())) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java index 0722ad190e..f9ab533c41 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java @@ -17,6 +17,7 @@ package org.springframework.boot.web.context; import java.io.File; +import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -111,10 +112,10 @@ public class WebServerPortFileWriter String extension = StringUtils.getFilenameExtension(this.file.getName()); name = name.substring(0, name.length() - extension.length() - 1); if (isUpperCase(name)) { - name = name + "-" + namespace.toUpperCase(); + name = name + "-" + namespace.toUpperCase(Locale.ENGLISH); } else { - name = name + "-" + namespace.toLowerCase(); + name = name + "-" + namespace.toLowerCase(Locale.ENGLISH); } if (StringUtils.hasLength(extension)) { name = name + "." + extension; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java index b771c62a9a..28476c0734 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.boot.web.servlet; +import java.util.Locale; + import javax.servlet.MultipartConfigElement; import org.springframework.util.Assert; @@ -110,7 +112,7 @@ public class MultipartConfigFactory { private long parseSize(String size) { Assert.hasLength(size, "Size must not be empty"); - size = size.toUpperCase(); + size = size.toUpperCase(Locale.ENGLISH); if (size.endsWith("KB")) { return Long.valueOf(size.substring(0, size.length() - 2)) * 1024; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java index b6cacc03b5..7107b8a313 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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.net.URL; import java.net.URLConnection; import java.security.CodeSource; import java.util.Arrays; +import java.util.Locale; import org.apache.commons.logging.Log; @@ -81,7 +82,7 @@ class DocumentRoot { this.logger.debug("Code archive: " + file); } if (file != null && file.exists() && !file.isDirectory() - && file.getName().toLowerCase().endsWith(extension)) { + && file.getName().toLowerCase(Locale.ENGLISH).endsWith(extension)) { return file.getAbsoluteFile(); } return null; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java index 11a8a29f3c..666cfb417f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java @@ -19,6 +19,7 @@ package org.springframework.boot.web.context; import java.io.File; import java.io.FileReader; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import org.junit.After; @@ -101,7 +102,7 @@ public class WebServerPortFileWriterTest { @Test public void createUpperCaseManagementPortFile() throws Exception { File file = this.temporaryFolder.newFile(); - file = new File(file.getParentFile(), file.getName().toUpperCase()); + file = new File(file.getParentFile(), file.getName().toUpperCase(Locale.ENGLISH)); WebServerPortFileWriter listener = new WebServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("management", 9090)); String managementFile = file.getName(); diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java index 346cb54ea2..9c0508e67f 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java @@ -24,6 +24,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; @@ -312,7 +313,8 @@ public class SysVinitLaunchScriptIT { private String buildImage(DockerClient docker) { String dockerfile = "src/test/resources/conf/" + this.os + "/" + this.version + "/Dockerfile"; - String tag = "spring-boot-it/" + this.os.toLowerCase() + ":" + this.version; + String tag = "spring-boot-it/" + this.os.toLowerCase(Locale.ENGLISH) + ":" + + this.version; BuildImageResultCallback resultCallback = new BuildImageResultCallback() { private List items = new ArrayList<>();