Commit 306c79f0 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '1.5.x'

parents 219b2d8c b4a7e1d6
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive; package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
import java.util.Locale;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -110,7 +112,7 @@ class CloudFoundrySecurityInterceptor { ...@@ -110,7 +112,7 @@ class CloudFoundrySecurityInterceptor {
String authorization = request.getHeaders().getFirst("Authorization"); String authorization = request.getHeaders().getFirst("Authorization");
String bearerPrefix = "bearer "; String bearerPrefix = "bearer ";
if (authorization == null if (authorization == null
|| !authorization.toLowerCase().startsWith(bearerPrefix)) { || !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) {
throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION, throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION,
"Authorization header is missing or invalid"); "Authorization header is missing or invalid");
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet; package org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
...@@ -104,7 +106,7 @@ class CloudFoundrySecurityInterceptor { ...@@ -104,7 +106,7 @@ class CloudFoundrySecurityInterceptor {
String authorization = request.getHeader("Authorization"); String authorization = request.getHeader("Authorization");
String bearerPrefix = "bearer "; String bearerPrefix = "bearer ";
if (authorization == null if (authorization == null
|| !authorization.toLowerCase().startsWith(bearerPrefix)) { || !authorization.toLowerCase(Locale.ENGLISH).startsWith(bearerPrefix)) {
throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION, throw new CloudFoundryAuthorizationException(Reason.MISSING_AUTHORIZATION,
"Authorization header is missing or invalid"); "Authorization header is missing or invalid");
} }
......
...@@ -21,6 +21,7 @@ import java.util.Arrays; ...@@ -21,6 +21,7 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -81,7 +82,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>> ...@@ -81,7 +82,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
if (items == null) { if (items == null) {
return Collections.emptySet(); return Collections.emptySet();
} }
return items.stream().map(String::toLowerCase) return items.stream().map(item -> item.toLowerCase(Locale.ENGLISH))
.collect(Collectors.toCollection(HashSet::new)); .collect(Collectors.toCollection(HashSet::new));
} }
...@@ -109,7 +110,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>> ...@@ -109,7 +110,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
} }
private boolean contains(Set<String> items, ExposableEndpoint<?> endpoint) { private boolean contains(Set<String> items, ExposableEndpoint<?> endpoint) {
return items.contains(endpoint.getId().toLowerCase()); return items.contains(endpoint.getId().toLowerCase(Locale.ENGLISH));
} }
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package org.springframework.boot.actuate.endpoint.invoke.reflect; package org.springframework.boot.actuate.endpoint.invoke.reflect;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Locale;
import org.springframework.boot.actuate.endpoint.OperationType; import org.springframework.boot.actuate.endpoint.OperationType;
import org.springframework.boot.actuate.endpoint.invoke.OperationParameters; import org.springframework.boot.actuate.endpoint.invoke.OperationParameters;
...@@ -81,8 +82,8 @@ public class OperationMethod { ...@@ -81,8 +82,8 @@ public class OperationMethod {
@Override @Override
public String toString() { public String toString() {
return "Operation " + this.operationType.name().toLowerCase() + " method " return "Operation " + this.operationType.name().toLowerCase(Locale.ENGLISH)
+ this.method; + " method " + this.method;
} }
} }
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.springframework.boot.actuate.health; package org.springframework.boot.actuate.health;
import java.util.Locale;
import java.util.function.Function; import java.util.function.Function;
/** /**
...@@ -28,7 +29,7 @@ public class HealthIndicatorNameFactory implements Function<String, String> { ...@@ -28,7 +29,7 @@ public class HealthIndicatorNameFactory implements Function<String, String> {
@Override @Override
public String apply(String name) { public String apply(String name) {
int index = name.toLowerCase().indexOf("healthindicator"); int index = name.toLowerCase(Locale.ENGLISH).indexOf("healthindicator");
if (index > 0) { if (index > 0) {
return name.substring(0, index); return name.substring(0, index);
} }
......
...@@ -25,6 +25,7 @@ import java.util.HashMap; ...@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -479,7 +480,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit ...@@ -479,7 +480,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
string.append(StringUtils.collectionToCommaDelimitedString(this.types)); string.append(StringUtils.collectionToCommaDelimitedString(this.types));
} }
string.append("; SearchStrategy: "); string.append("; SearchStrategy: ");
string.append(this.strategy.toString().toLowerCase()); string.append(this.strategy.toString().toLowerCase(Locale.ENGLISH));
string.append(")"); string.append(")");
return string.toString(); return string.toString();
} }
......
...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.session; ...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.session;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -252,7 +253,8 @@ public class SessionAutoConfiguration { ...@@ -252,7 +253,8 @@ public class SessionAutoConfiguration {
throw new SessionRepositoryUnavailableException("No session " throw new SessionRepositoryUnavailableException("No session "
+ "repository could be auto-configured, check your " + "repository could be auto-configured, check your "
+ "configuration (session store type is '" + "configuration (session store type is '"
+ storeType.name().toLowerCase() + "')", storeType); + storeType.name().toLowerCase(Locale.ENGLISH)
+ "')", storeType);
} }
} }
} }
......
...@@ -27,6 +27,7 @@ import java.net.URL; ...@@ -27,6 +27,7 @@ import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import groovy.lang.Grab; import groovy.lang.Grab;
...@@ -127,9 +128,10 @@ abstract class ArchiveCommand extends OptionParsingCommand { ...@@ -127,9 +128,10 @@ abstract class ArchiveCommand extends OptionParsingCommand {
+ this.type + " and at least one source file must be specified"); + this.type + " and at least one source file must be specified");
File output = new File((String) nonOptionArguments.remove(0)); File output = new File((String) nonOptionArguments.remove(0));
Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type), Assert.isTrue(
"The output '" + output + "' is not a " + this.type.toUpperCase() output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type),
+ " file."); "The output '" + output + "' is not a " + this.type.toUpperCase(
Locale.ENGLISH) + " file.");
deleteIfExists(output); deleteIfExists(output);
GroovyCompiler compiler = createCompiler(options); GroovyCompiler compiler = createCompiler(options);
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,6 +23,7 @@ import java.util.Collections; ...@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -158,7 +159,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> ...@@ -158,7 +159,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
matcher.group(1) + '-' + StringUtils.uncapitalize(matcher.group(2))); matcher.group(1) + '-' + StringUtils.uncapitalize(matcher.group(2)));
} }
matcher.appendTail(result); matcher.appendTail(result);
return result.toString().toLowerCase(); return result.toString().toLowerCase(Locale.ENGLISH);
} }
private String dotAppend(String prefix, String postfix) { private String dotAppend(String prefix, String postfix) {
......
...@@ -23,6 +23,7 @@ import java.nio.charset.Charset; ...@@ -23,6 +23,7 @@ import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -183,7 +184,7 @@ class JsonReader { ...@@ -183,7 +184,7 @@ class JsonReader {
private Deprecation.Level parseDeprecationLevel(String value) { private Deprecation.Level parseDeprecationLevel(String value) {
if (value != null) { if (value != null) {
try { try {
return Deprecation.Level.valueOf(value.toUpperCase()); return Deprecation.Level.valueOf(value.toUpperCase(Locale.ENGLISH));
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
// let's use the default // let's use the default
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,6 +19,7 @@ package org.springframework.boot.loader.tools; ...@@ -19,6 +19,7 @@ package org.springframework.boot.loader.tools;
import java.io.File; import java.io.File;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
/** /**
...@@ -42,7 +43,7 @@ public final class Layouts { ...@@ -42,7 +43,7 @@ public final class Layouts {
if (file == null) { if (file == null) {
throw new IllegalArgumentException("File must not be 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")) { if (lowerCaseFileName.endsWith(".jar")) {
return new Jar(); return new Jar();
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,6 +23,7 @@ import java.io.InputStreamReader; ...@@ -23,6 +23,7 @@ import java.io.InputStreamReader;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Locale;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
...@@ -123,7 +124,8 @@ public class RunProcess { ...@@ -123,7 +124,8 @@ public class RunProcess {
// There's a bug in the Windows VM (https://bugs.openjdk.java.net/browse/JDK-8023130) // There's a bug in the Windows VM (https://bugs.openjdk.java.net/browse/JDK-8023130)
// that means we need to avoid inheritIO // that means we need to avoid inheritIO
private static boolean isInheritIOBroken() { 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; return false;
} }
String runtime = System.getProperty("java.runtime.version"); String runtime = System.getProperty("java.runtime.version");
......
...@@ -27,6 +27,7 @@ import java.util.ArrayList; ...@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.jar.Manifest; import java.util.jar.Manifest;
...@@ -488,7 +489,7 @@ public class PropertiesLauncher extends Launcher { ...@@ -488,7 +489,7 @@ public class PropertiesLauncher extends Launcher {
if (isNestedArchivePath(file)) { if (isNestedArchivePath(file)) {
return null; return null;
} }
String name = file.getName().toLowerCase(); String name = file.getName().toLowerCase(Locale.ENGLISH);
if (name.endsWith(".jar") || name.endsWith(".zip")) { if (name.endsWith(".jar") || name.endsWith(".zip")) {
return new JarFileArchive(file); return new JarFileArchive(file);
} }
...@@ -564,7 +565,7 @@ public class PropertiesLauncher extends Launcher { ...@@ -564,7 +565,7 @@ public class PropertiesLauncher extends Launcher {
if (path.startsWith("./")) { if (path.startsWith("./")) {
path = path.substring(2); path = path.substring(2);
} }
String lowerCasePath = path.toLowerCase(); String lowerCasePath = path.toLowerCase(Locale.ENGLISH);
if (lowerCasePath.endsWith(".jar") || lowerCasePath.endsWith(".zip")) { if (lowerCasePath.endsWith(".jar") || lowerCasePath.endsWith(".zip")) {
return path; return path;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package org.springframework.boot.loader.util; package org.springframework.boot.loader.util;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
...@@ -188,7 +189,8 @@ public abstract class SystemPropertyUtils { ...@@ -188,7 +189,8 @@ public abstract class SystemPropertyUtils {
} }
if (propVal == null) { if (propVal == null) {
// Try uppercase with underscores as well. // Try uppercase with underscores as well.
propVal = System.getenv(key.toUpperCase().replace('.', '_')); propVal = System.getenv(key.toUpperCase(Locale.ENGLISH)
.replace('.', '_'));
} }
if (propVal != null) { if (propVal != null) {
return propVal; return propVal;
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.ansi; package org.springframework.boot.ansi;
import java.util.Locale;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
...@@ -35,7 +37,7 @@ public abstract class AnsiOutput { ...@@ -35,7 +37,7 @@ public abstract class AnsiOutput {
private static Boolean ansiCapable; private static Boolean ansiCapable;
private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name") private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name")
.toLowerCase(); .toLowerCase(Locale.ENGLISH);
private static final String ENCODE_START = "\033["; private static final String ENCODE_START = "\033[";
......
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
...@@ -250,7 +251,8 @@ public class ApplicationPidFileWriter ...@@ -250,7 +251,8 @@ public class ApplicationPidFileWriter
private final String[] properties; private final String[] properties;
SystemProperty(String name) { SystemProperty(String name) {
this.properties = new String[] { name.toUpperCase(), name.toLowerCase() }; this.properties = new String[] { name.toUpperCase(Locale.ENGLISH),
name.toLowerCase(Locale.ENGLISH) };
} }
@Override @Override
......
...@@ -18,6 +18,7 @@ package org.springframework.boot.context.logging; ...@@ -18,6 +18,7 @@ package org.springframework.boot.context.logging;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
...@@ -321,7 +322,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { ...@@ -321,7 +322,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
if ("false".equalsIgnoreCase(level)) { if ("false".equalsIgnoreCase(level)) {
return LogLevel.OFF; return LogLevel.OFF;
} }
return LogLevel.valueOf(level.toUpperCase()); return LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH));
} }
private void registerShutdownHookIfNecessary(Environment environment, private void registerShutdownHookIfNecessary(Environment environment,
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.context.properties.source; package org.springframework.boot.context.properties.source;
import java.util.Locale;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form; import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form;
/** /**
...@@ -76,7 +78,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { ...@@ -76,7 +78,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
if (result.length() > 0) { if (result.length() > 0) {
result.append("_"); result.append("_");
} }
result.append(name.getElement(i, Form.UNIFORM).toUpperCase()); result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH));
} }
return result.toString(); return result.toString();
} }
...@@ -93,11 +95,11 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { ...@@ -93,11 +95,11 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
} }
private Object convertLegacyNameElement(String element) { private Object convertLegacyNameElement(String element) {
return element.replace('-', '_').toUpperCase(); return element.replace('-', '_').toUpperCase(Locale.ENGLISH);
} }
private CharSequence processElementValue(CharSequence value) { private CharSequence processElementValue(CharSequence value) {
String result = value.toString().toLowerCase(); String result = value.toString().toLowerCase(Locale.ENGLISH);
return (isNumber(result) ? "[" + result + "]" : result); return (isNumber(result) ? "[" + result + "]" : result);
} }
......
...@@ -19,6 +19,7 @@ package org.springframework.boot.jdbc; ...@@ -19,6 +19,7 @@ package org.springframework.boot.jdbc;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Locale;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -133,7 +134,7 @@ public enum DatabaseDriver { ...@@ -133,7 +134,7 @@ public enum DatabaseDriver {
@Override @Override
protected boolean matchProductName(String productName) { protected boolean matchProductName(String productName) {
return super.matchProductName(productName) return super.matchProductName(productName)
|| productName.toLowerCase().startsWith("firebird"); || productName.toLowerCase(Locale.ENGLISH).startsWith("firebird");
} }
}, },
...@@ -146,7 +147,7 @@ public enum DatabaseDriver { ...@@ -146,7 +147,7 @@ public enum DatabaseDriver {
@Override @Override
protected boolean matchProductName(String productName) { protected boolean matchProductName(String productName) {
return super.matchProductName(productName) return super.matchProductName(productName)
|| productName.toLowerCase().startsWith("db2/"); || productName.toLowerCase(Locale.ENGLISH).startsWith("db2/");
} }
}, },
...@@ -170,7 +171,7 @@ public enum DatabaseDriver { ...@@ -170,7 +171,7 @@ public enum DatabaseDriver {
@Override @Override
protected boolean matchProductName(String productName) { protected boolean matchProductName(String productName) {
return super.matchProductName(productName) return super.matchProductName(productName)
|| productName.toLowerCase().contains("as/400"); || productName.toLowerCase(Locale.ENGLISH).contains("as/400");
} }
}, },
...@@ -222,7 +223,7 @@ public enum DatabaseDriver { ...@@ -222,7 +223,7 @@ public enum DatabaseDriver {
* @return the identifier * @return the identifier
*/ */
public String getId() { public String getId() {
return name().toLowerCase(); return name().toLowerCase(Locale.ENGLISH);
} }
protected boolean matchProductName(String productName) { protected boolean matchProductName(String productName) {
...@@ -230,7 +231,7 @@ public enum DatabaseDriver { ...@@ -230,7 +231,7 @@ public enum DatabaseDriver {
} }
protected Collection<String> getUrlPrefixes() { protected Collection<String> getUrlPrefixes() {
return Collections.singleton(this.name().toLowerCase()); return Collections.singleton(this.name().toLowerCase(Locale.ENGLISH));
} }
/** /**
...@@ -265,7 +266,8 @@ public enum DatabaseDriver { ...@@ -265,7 +266,8 @@ public enum DatabaseDriver {
public static DatabaseDriver fromJdbcUrl(String url) { public static DatabaseDriver fromJdbcUrl(String url) {
if (StringUtils.hasLength(url)) { if (StringUtils.hasLength(url)) {
Assert.isTrue(url.startsWith("jdbc"), "URL must start with 'jdbc'"); 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 (DatabaseDriver driver : values()) {
for (String urlPrefix : driver.getUrlPrefixes()) { for (String urlPrefix : driver.getUrlPrefixes()) {
String prefix = ":" + urlPrefix + ":"; String prefix = ":" + urlPrefix + ":";
......
...@@ -18,6 +18,7 @@ package org.springframework.boot.jdbc; ...@@ -18,6 +18,7 @@ package org.springframework.boot.jdbc;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Locale;
import javax.sql.DataSource; import javax.sql.DataSource;
...@@ -155,7 +156,7 @@ public enum EmbeddedDatabaseConnection { ...@@ -155,7 +156,7 @@ public enum EmbeddedDatabaseConnection {
if (productName == null) { if (productName == null) {
return false; return false;
} }
productName = productName.toUpperCase(); productName = productName.toUpperCase(Locale.ENGLISH);
EmbeddedDatabaseConnection[] candidates = EmbeddedDatabaseConnection.values(); EmbeddedDatabaseConnection[] candidates = EmbeddedDatabaseConnection.values();
for (EmbeddedDatabaseConnection candidate : candidates) { for (EmbeddedDatabaseConnection candidate : candidates) {
if (candidate != NONE && productName.contains(candidate.name())) { if (candidate != NONE && productName.contains(candidate.name())) {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package org.springframework.boot.web.context; package org.springframework.boot.web.context;
import java.io.File; import java.io.File;
import java.util.Locale;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -111,10 +112,10 @@ public class WebServerPortFileWriter ...@@ -111,10 +112,10 @@ public class WebServerPortFileWriter
String extension = StringUtils.getFilenameExtension(this.file.getName()); String extension = StringUtils.getFilenameExtension(this.file.getName());
name = name.substring(0, name.length() - extension.length() - 1); name = name.substring(0, name.length() - extension.length() - 1);
if (isUpperCase(name)) { if (isUpperCase(name)) {
name = name + "-" + namespace.toUpperCase(); name = name + "-" + namespace.toUpperCase(Locale.ENGLISH);
} }
else { else {
name = name + "-" + namespace.toLowerCase(); name = name + "-" + namespace.toLowerCase(Locale.ENGLISH);
} }
if (StringUtils.hasLength(extension)) { if (StringUtils.hasLength(extension)) {
name = name + "." + extension; name = name + "." + extension;
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.web.servlet; package org.springframework.boot.web.servlet;
import java.util.Locale;
import javax.servlet.MultipartConfigElement; import javax.servlet.MultipartConfigElement;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -110,7 +112,7 @@ public class MultipartConfigFactory { ...@@ -110,7 +112,7 @@ public class MultipartConfigFactory {
private long parseSize(String size) { private long parseSize(String size) {
Assert.hasLength(size, "Size must not be empty"); Assert.hasLength(size, "Size must not be empty");
size = size.toUpperCase(); size = size.toUpperCase(Locale.ENGLISH);
if (size.endsWith("KB")) { if (size.endsWith("KB")) {
return Long.valueOf(size.substring(0, size.length() - 2)) * 1024; return Long.valueOf(size.substring(0, size.length() - 2)) * 1024;
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -22,6 +22,7 @@ import java.net.URL; ...@@ -22,6 +22,7 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.security.CodeSource; import java.security.CodeSource;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
...@@ -81,7 +82,7 @@ class DocumentRoot { ...@@ -81,7 +82,7 @@ class DocumentRoot {
this.logger.debug("Code archive: " + file); this.logger.debug("Code archive: " + file);
} }
if (file != null && file.exists() && !file.isDirectory() if (file != null && file.exists() && !file.isDirectory()
&& file.getName().toLowerCase().endsWith(extension)) { && file.getName().toLowerCase(Locale.ENGLISH).endsWith(extension)) {
return file.getAbsoluteFile(); return file.getAbsoluteFile();
} }
return null; return null;
......
...@@ -19,6 +19,7 @@ package org.springframework.boot.web.context; ...@@ -19,6 +19,7 @@ package org.springframework.boot.web.context;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import org.junit.After; import org.junit.After;
...@@ -101,7 +102,7 @@ public class WebServerPortFileWriterTest { ...@@ -101,7 +102,7 @@ public class WebServerPortFileWriterTest {
@Test @Test
public void createUpperCaseManagementPortFile() throws Exception { public void createUpperCaseManagementPortFile() throws Exception {
File file = this.temporaryFolder.newFile(); 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); WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
listener.onApplicationEvent(mockEvent("management", 9090)); listener.onApplicationEvent(mockEvent("management", 9090));
String managementFile = file.getName(); String managementFile = file.getName();
......
...@@ -24,6 +24,7 @@ import java.util.Arrays; ...@@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -312,7 +313,8 @@ public class SysVinitLaunchScriptIT { ...@@ -312,7 +313,8 @@ public class SysVinitLaunchScriptIT {
private String buildImage(DockerClient docker) { private String buildImage(DockerClient docker) {
String dockerfile = "src/test/resources/conf/" + this.os + "/" + this.version String dockerfile = "src/test/resources/conf/" + this.os + "/" + this.version
+ "/Dockerfile"; + "/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() { BuildImageResultCallback resultCallback = new BuildImageResultCallback() {
private List<BuildResponseItem> items = new ArrayList<>(); private List<BuildResponseItem> items = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment