diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityInterceptor.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityInterceptor.java index 0ac971ff0cf..6a0945d6850 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityInterceptor.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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.actuate.cloudfoundry; +import java.util.Locale; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -107,7 +109,7 @@ class CloudFoundrySecurityInterceptor extends HandlerInterceptorAdapter { 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-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java index a9d6c555f4a..b0f45471d84 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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.actuate.endpoint; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -104,7 +105,7 @@ public class DataSourcePublicMetrics implements PublicMetrics { return "datasource.primary"; } if (name.length() > DATASOURCE_SUFFIX.length() - && name.toLowerCase().endsWith(DATASOURCE_SUFFIX.toLowerCase())) { + && name.toLowerCase(Locale.ENGLISH).endsWith(DATASOURCE_SUFFIX.toLowerCase())) { name = name.substring(0, name.length() - DATASOURCE_SUFFIX.length()); } return "datasource." + name; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java index 5c6b621e4c0..01b3a48375a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.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.endpoint; +import java.util.Locale; import java.util.Map; import org.springframework.boot.actuate.health.CompositeHealthIndicator; @@ -91,7 +92,7 @@ public class HealthEndpoint extends AbstractEndpoint { * @return the key */ private String getKey(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-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java index 6b09d57fba7..285232e1a78 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 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. @@ -24,6 +24,7 @@ import java.lang.management.ThreadMXBean; import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import org.springframework.boot.actuate.metrics.Metric; import org.springframework.core.Ordered; @@ -188,7 +189,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { * @return a metric friendly name */ private String beautifyGcName(String name) { - return StringUtils.replace(name, " ", "_").toLowerCase(); + return StringUtils.replace(name, " ", "_").toLowerCase(Locale.ENGLISH); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/LoggersEndpointMBean.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/LoggersEndpointMBean.java index e5f324d8d31..b1b634002b9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/LoggersEndpointMBean.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/LoggersEndpointMBean.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.actuate.endpoint.jmx; +import java.util.Locale; + import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.boot.actuate.endpoint.Endpoint; @@ -52,7 +54,7 @@ public class LoggersEndpointMBean extends EndpointMBean { @ManagedOperation(description = "Set log level for a given logger") public void setLogLevel(String loggerName, String logLevel) { Assert.notNull(logLevel, "LogLevel must not be null"); - LogLevel level = LogLevel.valueOf(logLevel.toUpperCase()); + LogLevel level = LogLevel.valueOf(logLevel.toUpperCase(Locale.ENGLISH)); getEndpoint().setLogLevel(loggerName, level); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java index ba5e594b6c9..5d7b77ee4a6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.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. @@ -20,6 +20,7 @@ import java.security.Principal; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -151,7 +152,7 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter configuration) { String level = configuration.get("configuredLevel"); try { - return (level == null ? null : LogLevel.valueOf(level.toUpperCase())); + return (level == null ? null + : LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH))); } catch (IllegalArgumentException ex) { throw new InvalidLogLevelException(level); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java index 17b488fbab7..49764577d57 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java @@ -23,6 +23,7 @@ import java.util.Enumeration; 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.concurrent.TimeUnit; @@ -165,7 +166,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order Enumeration names = request.getHeaderNames(); while (names.hasMoreElements()) { String name = names.nextElement(); - if (!excludedHeaders.contains(name.toLowerCase())) { + if (!excludedHeaders.contains(name.toLowerCase(Locale.ENGLISH))) { headers.put(name, getHeaderValue(request, name)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java index a114ce1e14c..4057f9fbcc3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.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.autoconfigure.cache; +import java.util.Locale; + import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; @@ -50,7 +52,8 @@ class CacheCondition extends SpringBootCondition { } CacheType cacheType = CacheConfigurations .getType(((AnnotationMetadata) metadata).getClassName()); - String value = resolver.getProperty("type").replace('-', '_').toUpperCase(); + String value = resolver.getProperty("type").replace('-', '_') + .toUpperCase(Locale.ENGLISH); if (value.equals(cacheType.name())) { return ConditionOutcome.match(message.because(value + " cache type")); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index 4ef91899ab8..e6f834a0781 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.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. @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import org.springframework.beans.factory.BeanFactory; @@ -399,7 +400,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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java index 53629457654..e249fbc0467 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.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. @@ -17,6 +17,7 @@ package org.springframework.boot.autoconfigure.data.cassandra; import java.util.List; +import java.util.Locale; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; @@ -114,7 +115,8 @@ public class CassandraDataAutoConfiguration { session.setKeyspaceName(this.properties.getKeyspaceName()); String name = this.propertyResolver.getProperty("schemaAction", SchemaAction.NONE.name()); - SchemaAction schemaAction = SchemaAction.valueOf(name.toUpperCase()); + SchemaAction schemaAction = SchemaAction.valueOf( + name.toUpperCase(Locale.ENGLISH)); session.setSchemaAction(schemaAction); return session; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java index f15bf05e2f0..c248cff239c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/EmbeddedDatabaseConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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. @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.jdbc; import java.sql.Connection; import java.sql.SQLException; +import java.util.Locale; import javax.sql.DataSource; @@ -173,7 +174,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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java index 848e753097c..73f5fa67182 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.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.autoconfigure.session; +import java.util.Locale; + import javax.annotation.PostConstruct; import org.springframework.beans.factory.ObjectProvider; @@ -100,7 +102,8 @@ public class SessionAutoConfiguration { if (storeType != null) { throw new IllegalArgumentException("No session repository could be " + "auto-configured, check your configuration (session store " - + "type is '" + storeType.name().toLowerCase() + "')"); + + "type is '" + storeType.name().toLowerCase(Locale.ENGLISH) + + "')"); } throw new IllegalArgumentException("No Spring Session store is " + "configured: set the 'spring.session.store-type' property"); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionCondition.java index ea2f4cd7aaa..da4aea0a663 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionCondition.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.autoconfigure.session; +import java.util.Locale; + import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; @@ -45,7 +47,8 @@ class SessionCondition extends SpringBootCondition { return ConditionOutcome.noMatch( message.didNotFind("spring.session.store-type property").atAll()); } - String value = resolver.getProperty("store-type").replace('-', '_').toUpperCase(); + String value = resolver.getProperty("store-type").replace('-', '_') + .toUpperCase(Locale.ENGLISH); if (value.equals(sessionStoreType.name())) { return ConditionOutcome.match(message .found("spring.session.store-type property").items(sessionStoreType)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java index 20fa52d83e8..988aeb83c79 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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. @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.web; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -78,7 +79,7 @@ public abstract class AbstractErrorController implements ErrorController { if (parameter == null) { return false; } - return !"false".equals(parameter.toLowerCase()); + return !"false".equals(parameter.toLowerCase(Locale.ENGLISH)); } protected HttpStatus getStatus(HttpServletRequest request) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index 1862157c8ec..5ec07abf4ed 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.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. @@ -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; @@ -129,9 +130,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-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java index 6bd7d6bbcd8..dc70e645f93 100644 --- a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java +++ b/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; @@ -306,7 +307,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(); diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java index aec482089db..030ffa36950 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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 sample.data.gemfire.service; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import javax.annotation.PostConstruct; @@ -126,7 +127,7 @@ public class GemstoneServiceImpl implements GemstoneService { } Gemstone validate(Gemstone gemstone) { - if (!APPROVED_GEMS.contains(gemstone.getName().toUpperCase())) { + if (!APPROVED_GEMS.contains(gemstone.getName().toUpperCase(Locale.ENGLISH))) { // NOTE if the Gemstone is not valid, throw error... // Should cause transaction to rollback in GemFire! System.err.printf("Illegal Gemstone [%1$s]!%n", gemstone.getName()); diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java index dcd5bd0befd..5df6ca9c49e 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java +++ b/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-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java index 850ea012f73..826e113d425 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.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.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-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java index 4d65e633fb1..700987f0266 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.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.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.ListIterator; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -197,7 +198,7 @@ public class ConfigurationMetadata { previous = current; } - return dashed.toString().toLowerCase(); + return dashed.toString().toLowerCase(Locale.ENGLISH); } private static > List flattenValues(Map> map) { diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index e7a0ebc679e..390286aa619 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/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. @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -45,13 +46,14 @@ public final class Layouts { if (file == null) { throw new IllegalArgumentException("File must not be null"); } - if (file.getName().toLowerCase().endsWith(".jar")) { + if (file.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { return new Jar(); } - if (file.getName().toLowerCase().endsWith(".war")) { + if (file.getName().toLowerCase(Locale.ENGLISH).endsWith(".war")) { return new War(); } - if (file.isDirectory() || file.getName().toLowerCase().endsWith(".zip")) { + if (file.isDirectory() + || file.getName().toLowerCase(Locale.ENGLISH).endsWith(".zip")) { return new Expanded(); } throw new IllegalStateException("Unable to deduce layout for '" + file + "'"); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java index c6a4cc7c65a..8c81f66b349 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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; @@ -128,7 +129,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-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index 395af6eea8c..edd4276c437 100755 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.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. @@ -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; @@ -489,7 +490,7 @@ public class PropertiesLauncher extends Launcher { } private Archive getArchive(File file) throws IOException { - String name = file.getName().toLowerCase(); + String name = file.getName().toLowerCase(Locale.ENGLISH); if (name.endsWith(".jar") || name.endsWith(".zip")) { return new JarFileArchive(file); } @@ -566,7 +567,8 @@ public class PropertiesLauncher extends Launcher { if (path.startsWith("./")) { path = path.substring(2); } - if (path.toLowerCase().endsWith(".jar") || path.toLowerCase().endsWith(".zip")) { + String lowercasePath = path.toLowerCase(Locale.ENGLISH); + if (lowercasePath.endsWith(".jar") || lowercasePath.endsWith(".zip")) { return path; } if (path.endsWith("/*")) { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index 2bbfa8bf0fe..b9b949b9076 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.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. @@ -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/src/main/java/org/springframework/boot/ansi/AnsiOutput.java b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java index 539954b75b7..1c9c7c9cdfa 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java +++ b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 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/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java index 710197bedf8..14cb04172f9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.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. @@ -18,6 +18,7 @@ package org.springframework.boot.bind; import java.util.Collection; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; @@ -184,7 +185,7 @@ public class PropertySourcesPropertyValues implements PropertyValues { // Probably could not convert to Object, weird, but ignorable } if (value == null) { - value = source.getProperty(propertyName.toUpperCase()); + value = source.getProperty(propertyName.toUpperCase(Locale.ENGLISH)); } putIfAbsent(propertyName, value, source); } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java index 5db206cc573..5916df0cd80 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.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. @@ -17,6 +17,7 @@ package org.springframework.boot.bind; import java.util.EnumSet; +import java.util.Locale; import java.util.Set; import org.springframework.core.convert.ConversionFailedException; @@ -127,7 +128,8 @@ class RelaxedConversionService implements ConversionService { source = source.trim(); for (T candidate : (Set) EnumSet.allOf(this.enumType)) { RelaxedNames names = new RelaxedNames( - candidate.name().replace('_', '-').toLowerCase()); + candidate.name().replace('_', '-') + .toLowerCase(Locale.ENGLISH)); for (String name : names) { if (name.equals(source)) { return candidate; diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java index 07f793c5b83..afc4245c53e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.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. @@ -18,6 +18,7 @@ package org.springframework.boot.bind; import java.util.Iterator; import java.util.LinkedHashSet; +import java.util.Locale; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -91,7 +92,7 @@ public final class RelaxedNames implements Iterable { @Override public String apply(String value) { - return value.isEmpty() ? value : value.toLowerCase(); + return value.isEmpty() ? value : value.toLowerCase(Locale.ENGLISH); } }, @@ -100,7 +101,7 @@ public final class RelaxedNames implements Iterable { @Override public String apply(String value) { - return value.isEmpty() ? value : value.toUpperCase(); + return value.isEmpty() ? value : value.toUpperCase(Locale.ENGLISH); } }; @@ -225,7 +226,7 @@ public final class RelaxedNames implements Iterable { } StringBuilder builder = new StringBuilder(); for (String field : SEPARATED_TO_CAMEL_CASE_PATTERN.split(value)) { - field = (caseInsensitive ? field.toLowerCase() : field); + field = (caseInsensitive ? field.toLowerCase(Locale.ENGLISH) : field); builder.append( builder.length() == 0 ? field : StringUtils.capitalize(field)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java index d82f1e2ef02..01daf51b809 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/AnsiOutputApplicationListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 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.context.config; +import java.util.Locale; + import org.springframework.boot.ansi.AnsiOutput; import org.springframework.boot.ansi.AnsiOutput.Enabled; import org.springframework.boot.bind.RelaxedPropertyResolver; @@ -40,7 +42,8 @@ public class AnsiOutputApplicationListener event.getEnvironment(), "spring.output.ansi."); if (resolver.containsProperty("enabled")) { String enabled = resolver.getProperty("enabled"); - AnsiOutput.setEnabled(Enum.valueOf(Enabled.class, enabled.toUpperCase())); + AnsiOutput.setEnabled(Enum.valueOf(Enabled.class, + enabled.toUpperCase(Locale.ENGLISH))); } if (resolver.containsProperty("console-available")) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java index c8abfb69dca..deaf44cc43b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.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. @@ -26,6 +26,7 @@ import java.security.CodeSource; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.jar.JarFile; import org.apache.commons.logging.Log; @@ -177,7 +178,7 @@ public abstract class AbstractEmbeddedServletContainerFactory 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/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 37c20533f0c..5fce045685e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 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. @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import org.apache.commons.logging.Log; @@ -144,9 +145,9 @@ public class PropertySourcesLoader { } private boolean canLoadFileExtension(PropertySourceLoader loader, Resource resource) { - String filename = resource.getFilename().toLowerCase(); + String filename = resource.getFilename().toLowerCase(Locale.ENGLISH); for (String extension : loader.getFileExtensions()) { - if (filename.endsWith("." + extension.toLowerCase())) { + if (filename.endsWith("." + extension.toLowerCase(Locale.ENGLISH))) { return true; } } diff --git a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index adf4984548e..1c868f4919c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/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/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index 209f7fcaf84..06ece883153 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.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. @@ -17,6 +17,7 @@ package org.springframework.boot.logging; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicBoolean; @@ -370,7 +371,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/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java b/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java index 18073ee275d..68484c02945 100644 --- a/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java +++ b/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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. @@ -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/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java b/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java index 0d46956a3f0..48c8ea95b2a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java +++ b/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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. @@ -17,6 +17,7 @@ package org.springframework.boot.system; import java.io.File; +import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -113,10 +114,10 @@ public class EmbeddedServerPortFileWriter String extension = StringUtils.getFilenameExtension(this.file.getName()); name = name.substring(0, name.length() - extension.length() - 1); if (isUpperCase(name)) { - name = name + "-" + contextName.toUpperCase(); + name = name + "-" + contextName.toUpperCase(Locale.ENGLISH); } else { - name = name + "-" + contextName.toLowerCase(); + name = name + "-" + contextName.toLowerCase(Locale.ENGLISH); } if (StringUtils.hasLength(extension)) { name = name + "." + extension; diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java index fe7ccb6d804..28476c0734e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java index 4b20f7da438..f4213cf9960 100644 --- a/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 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.system; import java.io.File; import java.io.FileReader; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import org.junit.After; @@ -103,7 +104,7 @@ public class EmbeddedServerPortFileWriterTests { @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)); EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("management", 9090)); String managementFile = file.getName();