From 9cedad11d8d2197a54732667a15344983de5c437 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Ozawa Date: Wed, 25 Feb 2015 00:32:04 +0900 Subject: [PATCH] Revert "HADOOP-11602. Fix toUpperCase/toLowerCase to use Locale.ENGLISH. (ozawa)" This reverts commit 946456c6d88780abe0251b098dd771e9e1e93ab3. Conflicts: hadoop-common-project/hadoop-common/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaByStorageTypeEntry.java --- .../tools/StabilityOptions.java | 5 ++- .../AltKerberosAuthenticationHandler.java | 6 ++-- .../authentication/util/TestKerberosUtil.java | 14 ++++---- .../hadoop-common/CHANGES.txt | 2 -- .../org/apache/hadoop/conf/Configuration.java | 3 +- .../org/apache/hadoop/crypto/CipherSuite.java | 3 +- .../crypto/key/JavaKeyStoreProvider.java | 3 +- .../java/org/apache/hadoop/fs/FileSystem.java | 7 ++-- .../org/apache/hadoop/fs/StorageType.java | 3 +- .../apache/hadoop/fs/permission/AclEntry.java | 6 ++-- .../org/apache/hadoop/fs/shell/find/Name.java | 5 ++- .../io/compress/CompressionCodecFactory.java | 6 ++-- .../hadoop/metrics2/impl/MetricsConfig.java | 7 ++-- .../metrics2/impl/MetricsSystemImpl.java | 2 +- .../apache/hadoop/security/SecurityUtil.java | 5 ++- .../security/WhitelistBasedResolver.java | 4 +-- .../ssl/FileBasedKeyStoresFactory.java | 4 +-- .../hadoop/security/ssl/SSLFactory.java | 3 +- .../security/ssl/SSLHostnameVerifier.java | 10 +++--- .../DelegationTokenAuthenticationHandler.java | 3 +- .../web/DelegationTokenAuthenticator.java | 5 ++- .../org/apache/hadoop/util/StringUtils.java | 2 +- .../java/org/apache/hadoop/ipc/TestIPC.java | 3 +- .../org/apache/hadoop/ipc/TestSaslRPC.java | 3 +- .../hadoop/security/TestSecurityUtil.java | 6 ++-- .../security/TestUserGroupInformation.java | 5 ++- .../hadoop/test/TimedOutTestsListener.java | 4 +-- .../org/apache/hadoop/util/TestWinUtils.java | 7 ++-- .../org/apache/hadoop/nfs/NfsExports.java | 5 ++- .../server/CheckUploadContentTypeFilter.java | 4 +-- .../hadoop/fs/http/server/FSOperations.java | 4 +-- .../http/server/HttpFSParametersProvider.java | 4 +-- .../org/apache/hadoop/lib/server/Server.java | 3 +- .../hadoop/FileSystemAccessService.java | 5 ++- .../org/apache/hadoop/lib/wsrs/EnumParam.java | 3 +- .../apache/hadoop/lib/wsrs/EnumSetParam.java | 3 +- .../hadoop/lib/wsrs/ParametersProvider.java | 3 +- .../org/apache/hadoop/hdfs/XAttrHelper.java | 21 ++++-------- .../hadoop/hdfs/protocol/HdfsConstants.java | 3 +- .../BlockStoragePolicySuite.java | 4 +-- .../server/common/HdfsServerConstants.java | 5 ++- .../hdfs/server/datanode/StorageLocation.java | 4 +-- .../hdfs/server/namenode/FSEditLogOp.java | 3 +- .../namenode/QuotaByStorageTypeEntry.java | 5 ++- .../server/namenode/SecondaryNameNode.java | 2 +- .../org/apache/hadoop/hdfs/tools/GetConf.java | 17 +++++----- .../OfflineEditsVisitorFactory.java | 7 ++-- .../offlineImageViewer/FSImageHandler.java | 3 +- .../apache/hadoop/hdfs/web/AuthFilter.java | 3 +- .../apache/hadoop/hdfs/web/ParamFilter.java | 3 +- .../hadoop/hdfs/web/WebHdfsFileSystem.java | 5 ++- .../hadoop/hdfs/web/resources/EnumParam.java | 3 +- .../hdfs/web/resources/EnumSetParam.java | 4 +-- .../snapshot/TestSnapshotManager.java | 5 ++- .../jobhistory/JobHistoryEventHandler.java | 4 +-- .../v2/app/webapp/AppController.java | 2 +- .../hadoop/mapreduce/TypeConverter.java | 3 +- .../hadoop/mapreduce/v2/util/MRApps.java | 5 ++- .../hadoop/mapreduce/TestTypeConverter.java | 4 +-- .../java/org/apache/hadoop/mapred/Task.java | 3 +- .../counters/FileSystemCounterGroup.java | 2 +- .../mapreduce/filecache/DistributedCache.java | 4 +-- .../mapreduce/lib/db/DBInputFormat.java | 4 +-- .../apache/hadoop/mapreduce/tools/CLI.java | 8 ++--- .../java/org/apache/hadoop/fs/TestDFSIO.java | 20 +++++------ .../org/apache/hadoop/fs/TestFileSystem.java | 6 +--- .../org/apache/hadoop/fs/slive/Constants.java | 6 ++-- .../apache/hadoop/fs/slive/OperationData.java | 4 +-- .../hadoop/fs/slive/OperationOutput.java | 4 +-- .../org/apache/hadoop/fs/slive/SliveTest.java | 3 +- .../java/org/apache/hadoop/io/FileBench.java | 17 ++++------ .../org/apache/hadoop/mapred/TestMapRed.java | 3 +- .../hadoop/examples/DBCountPageView.java | 3 +- .../plugin/versioninfo/VersionInfoMojo.java | 4 +-- .../fs/azure/AzureNativeFileSystemStore.java | 4 +-- .../apache/hadoop/tools/util/DistCpUtils.java | 11 +++--- .../org/apache/hadoop/tools/DistCpV1.java | 5 +-- .../gridmix/GridmixJobSubmissionPolicy.java | 3 +- .../tools/rumen/HadoopLogsAnalyzer.java | 34 +++++++++---------- .../apache/hadoop/tools/rumen/JobBuilder.java | 3 +- .../apache/hadoop/tools/rumen/LoggedTask.java | 3 +- .../hadoop/tools/rumen/LoggedTaskAttempt.java | 3 +- .../apache/hadoop/streaming/Environment.java | 2 +- .../yarn/client/cli/ApplicationCLI.java | 5 ++- .../hadoop/yarn/client/cli/NodeCLI.java | 4 +-- .../impl/pb/GetApplicationsRequestPBImpl.java | 6 ++-- .../ApplicationSubmissionContextPBImpl.java | 3 +- .../hadoop/yarn/webapp/hamlet/HamletGen.java | 5 ++- .../webapp/AHSWebServices.java | 4 +-- .../timeline/webapp/TimelineWebServices.java | 3 +- .../yarn/server/webapp/WebServices.java | 10 +++--- .../resourcemanager/ClientRMService.java | 3 +- .../resource/ResourceWeights.java | 3 +- .../CapacitySchedulerConfiguration.java | 6 ++-- .../fair/FairSchedulerConfiguration.java | 3 +- .../scheduler/fair/SchedulingPolicy.java | 3 +- .../resourcemanager/webapp/NodesPage.java | 3 +- .../resourcemanager/webapp/RMWebServices.java | 19 ++++------- 98 files changed, 192 insertions(+), 332 deletions(-) diff --git a/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/StabilityOptions.java b/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/StabilityOptions.java index 657dbce8128..dbce31e1eb4 100644 --- a/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/StabilityOptions.java +++ b/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/StabilityOptions.java @@ -21,7 +21,6 @@ import com.sun.javadoc.DocErrorReporter; import java.util.ArrayList; import java.util.List; -import java.util.Locale; class StabilityOptions { public static final String STABLE_OPTION = "-stable"; @@ -29,7 +28,7 @@ class StabilityOptions { public static final String UNSTABLE_OPTION = "-unstable"; public static Integer optionLength(String option) { - String opt = option.toLowerCase(Locale.ENGLISH); + String opt = option.toLowerCase(); if (opt.equals(UNSTABLE_OPTION)) return 1; if (opt.equals(EVOLVING_OPTION)) return 1; if (opt.equals(STABLE_OPTION)) return 1; @@ -39,7 +38,7 @@ class StabilityOptions { public static void validOptions(String[][] options, DocErrorReporter reporter) { for (int i = 0; i < options.length; i++) { - String opt = options[i][0].toLowerCase(Locale.ENGLISH); + String opt = options[i][0].toLowerCase(); if (opt.equals(UNSTABLE_OPTION)) { RootDocProcessor.stability = UNSTABLE_OPTION; } else if (opt.equals(EVOLVING_OPTION)) { diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AltKerberosAuthenticationHandler.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AltKerberosAuthenticationHandler.java index dae3b50ad1c..987330fa0e5 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AltKerberosAuthenticationHandler.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AltKerberosAuthenticationHandler.java @@ -14,7 +14,6 @@ package org.apache.hadoop.security.authentication.server; import java.io.IOException; -import java.util.Locale; import java.util.Properties; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -69,8 +68,7 @@ public abstract class AltKerberosAuthenticationHandler NON_BROWSER_USER_AGENTS, NON_BROWSER_USER_AGENTS_DEFAULT) .split("\\W*,\\W*"); for (int i = 0; i < nonBrowserUserAgents.length; i++) { - nonBrowserUserAgents[i] = - nonBrowserUserAgents[i].toLowerCase(Locale.ENGLISH); + nonBrowserUserAgents[i] = nonBrowserUserAgents[i].toLowerCase(); } } @@ -122,7 +120,7 @@ public abstract class AltKerberosAuthenticationHandler if (userAgent == null) { return false; } - userAgent = userAgent.toLowerCase(Locale.ENGLISH); + userAgent = userAgent.toLowerCase(); boolean isBrowser = true; for (String nonBrowserUserAgent : nonBrowserUserAgents) { if (userAgent.contains(nonBrowserUserAgent)) { diff --git a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/util/TestKerberosUtil.java b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/util/TestKerberosUtil.java index 89e07d1a5f0..b0e8f04a8f7 100644 --- a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/util/TestKerberosUtil.java +++ b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/util/TestKerberosUtil.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Locale; import java.util.regex.Pattern; import org.apache.directory.server.kerberos.shared.keytab.Keytab; @@ -59,25 +58,24 @@ public class TestKerberosUtil { // send null hostname Assert.assertEquals("When no hostname is sent", - service + "/" + localHostname.toLowerCase(Locale.ENGLISH), + service + "/" + localHostname.toLowerCase(), KerberosUtil.getServicePrincipal(service, null)); // send empty hostname Assert.assertEquals("When empty hostname is sent", - service + "/" + localHostname.toLowerCase(Locale.ENGLISH), + service + "/" + localHostname.toLowerCase(), KerberosUtil.getServicePrincipal(service, "")); // send 0.0.0.0 hostname Assert.assertEquals("When 0.0.0.0 hostname is sent", - service + "/" + localHostname.toLowerCase(Locale.ENGLISH), + service + "/" + localHostname.toLowerCase(), KerberosUtil.getServicePrincipal(service, "0.0.0.0")); // send uppercase hostname Assert.assertEquals("When uppercase hostname is sent", - service + "/" + testHost.toLowerCase(Locale.ENGLISH), + service + "/" + testHost.toLowerCase(), KerberosUtil.getServicePrincipal(service, testHost)); // send lowercase hostname Assert.assertEquals("When lowercase hostname is sent", - service + "/" + testHost.toLowerCase(Locale.ENGLISH), - KerberosUtil.getServicePrincipal( - service, testHost.toLowerCase(Locale.ENGLISH))); + service + "/" + testHost.toLowerCase(), + KerberosUtil.getServicePrincipal(service, testHost.toLowerCase())); } @Test diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 68d686eb1fd..e9ddb7db570 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -405,8 +405,6 @@ Trunk (Unreleased) HADOOP-11585. Fix formatting in Tracing.md (Masatake Iwasaki via aw) - HADOOP-11602. Fix toUpperCase/toLowerCase to use Locale.ENGLISH. (ozawa) - HADOOP-11625. Minor fixes to command manual & SLA doc (aw) OPTIMIZATIONS diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java index 5909e62b5ee..02654b77b57 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java @@ -46,7 +46,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; @@ -1452,7 +1451,7 @@ public class Configuration implements Iterable>, return defaultValue; } - valueString = valueString.toLowerCase(Locale.ENGLISH); + valueString = valueString.toLowerCase(); if ("true".equals(valueString)) return true; diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CipherSuite.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CipherSuite.java index c5601eba7f7..c9355d7cbf3 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CipherSuite.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CipherSuite.java @@ -18,7 +18,6 @@ package org.apache.hadoop.crypto; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience; /** @@ -98,7 +97,7 @@ public enum CipherSuite { String[] parts = name.split("/"); StringBuilder suffix = new StringBuilder(); for (String part : parts) { - suffix.append(".").append(part.toLowerCase(Locale.ENGLISH)); + suffix.append(".").append(part.toLowerCase()); } return suffix.toString(); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java index 9e09b6ec546..bfec1ef1a90 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java @@ -53,7 +53,6 @@ import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; @@ -423,7 +422,7 @@ public class JavaKeyStoreProvider extends KeyProvider { @Override public KeyVersion createKey(String name, byte[] material, Options options) throws IOException { - Preconditions.checkArgument(name.equals(name.toLowerCase(Locale.ENGLISH)), + Preconditions.checkArgument(name.equals(name.toLowerCase()), "Uppercase key names are unsupported: %s", name); writeLock.lock(); try { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index f52ecadd473..cfa519861ae 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -33,7 +33,6 @@ import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.ServiceLoader; @@ -2796,10 +2795,8 @@ public abstract class FileSystem extends Configured implements Closeable { } Key(URI uri, Configuration conf, long unique) throws IOException { - scheme = uri.getScheme() == null ? - "" : uri.getScheme().toLowerCase(Locale.ENGLISH); - authority = uri.getAuthority() == null ? - "" : uri.getAuthority().toLowerCase(Locale.ENGLISH); + scheme = uri.getScheme()==null?"":uri.getScheme().toLowerCase(); + authority = uri.getAuthority()==null?"":uri.getAuthority().toLowerCase(); this.unique = unique; this.ugi = UserGroupInformation.getCurrentUser(); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/StorageType.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/StorageType.java index 24055d76d1a..e3065021216 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/StorageType.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/StorageType.java @@ -21,7 +21,6 @@ package org.apache.hadoop.fs; import java.util.Arrays; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; @@ -79,7 +78,7 @@ public enum StorageType { } public static StorageType parseStorageType(String s) { - return StorageType.valueOf(s.toUpperCase(Locale.ENGLISH)); + return StorageType.valueOf(s.toUpperCase()); } private static List getNonTransientTypes() { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclEntry.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclEntry.java index 63975647507..b9def6447a8 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclEntry.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclEntry.java @@ -20,7 +20,6 @@ package org.apache.hadoop.fs.permission; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Locale; import com.google.common.base.Objects; @@ -107,7 +106,7 @@ public class AclEntry { sb.append("default:"); } if (type != null) { - sb.append(type.toString().toLowerCase(Locale.ENGLISH)); + sb.append(type.toString().toLowerCase()); } sb.append(':'); if (name != null) { @@ -264,8 +263,7 @@ public class AclEntry { AclEntryType aclType = null; try { - aclType = Enum.valueOf( - AclEntryType.class, split[index].toUpperCase(Locale.ENGLISH)); + aclType = Enum.valueOf(AclEntryType.class, split[index].toUpperCase()); builder.setType(aclType); index++; } catch (IllegalArgumentException iae) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Name.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Name.java index 4c937ef8aa0..88314c6474b 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Name.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Name.java @@ -19,7 +19,6 @@ package org.apache.hadoop.fs.shell.find; import java.io.IOException; import java.util.Deque; -import java.util.Locale; import org.apache.hadoop.fs.GlobPattern; import org.apache.hadoop.fs.shell.PathData; @@ -74,7 +73,7 @@ final class Name extends BaseExpression { public void prepare() throws IOException { String argPattern = getArgument(1); if (!caseSensitive) { - argPattern = argPattern.toLowerCase(Locale.ENGLISH); + argPattern = argPattern.toLowerCase(); } globPattern = new GlobPattern(argPattern); } @@ -83,7 +82,7 @@ final class Name extends BaseExpression { public Result apply(PathData item, int depth) throws IOException { String name = getPath(item).getName(); if (!caseSensitive) { - name = name.toLowerCase(Locale.ENGLISH); + name = name.toLowerCase(); } if (globPattern.matches(name)) { return Result.PASS; diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java index 6d168238dab..eb35759c9c8 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java @@ -65,10 +65,10 @@ public class CompressionCodecFactory { codecsByClassName.put(codec.getClass().getCanonicalName(), codec); String codecName = codec.getClass().getSimpleName(); - codecsByName.put(codecName.toLowerCase(Locale.ENGLISH), codec); + codecsByName.put(codecName.toLowerCase(), codec); if (codecName.endsWith("Codec")) { codecName = codecName.substring(0, codecName.length() - "Codec".length()); - codecsByName.put(codecName.toLowerCase(Locale.ENGLISH), codec); + codecsByName.put(codecName.toLowerCase(), codec); } } @@ -240,7 +240,7 @@ public class CompressionCodecFactory { CompressionCodec codec = getCodecByClassName(codecName); if (codec == null) { // trying to get the codec by name in case the name was specified instead a class - codec = codecsByName.get(codecName.toLowerCase(Locale.ENGLISH)); + codec = codecsByName.get(codecName.toLowerCase()); } return codec; } diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java index f87ef4d4cc0..167205e93e3 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java @@ -85,13 +85,12 @@ class MetricsConfig extends SubsetConfiguration { private ClassLoader pluginLoader; MetricsConfig(Configuration c, String prefix) { - super(c, prefix.toLowerCase(Locale.ENGLISH), "."); + super(c, prefix.toLowerCase(Locale.US), "."); } static MetricsConfig create(String prefix) { - return loadFirst(prefix, "hadoop-metrics2" + "-" - + prefix.toLowerCase(Locale.ENGLISH) - +".properties", DEFAULT_FILE_NAME); + return loadFirst(prefix, "hadoop-metrics2-"+ prefix.toLowerCase(Locale.US) + +".properties", DEFAULT_FILE_NAME); } static MetricsConfig create(String prefix, String... fileNames) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java index 8964934c336..32b00f3fdfa 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java @@ -617,6 +617,6 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource { String m = System.getProperty(MS_INIT_MODE_KEY); String m2 = m == null ? System.getenv(MS_INIT_MODE_KEY) : m; return InitMode.valueOf((m2 == null ? InitMode.NORMAL.name() : m2) - .toUpperCase(Locale.ENGLISH)); + .toUpperCase(Locale.US)); } } diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java index 355ea91988f..7cbee26f187 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java @@ -182,8 +182,7 @@ public class SecurityUtil { if (fqdn == null || fqdn.isEmpty() || fqdn.equals("0.0.0.0")) { fqdn = getLocalHostName(); } - return components[0] + "/" + fqdn.toLowerCase(Locale.ENGLISH) + "@" - + components[2]; + return components[0] + "/" + fqdn.toLowerCase(Locale.US) + "@" + components[2]; } static String getLocalHostName() throws UnknownHostException { @@ -380,7 +379,7 @@ public class SecurityUtil { } host = addr.getAddress().getHostAddress(); } else { - host = addr.getHostName().toLowerCase(Locale.ENGLISH); + host = addr.getHostName().toLowerCase(); } return new Text(host + ":" + addr.getPort()); } diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/WhitelistBasedResolver.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/WhitelistBasedResolver.java index 59d149217de..dc0815ed768 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/WhitelistBasedResolver.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/WhitelistBasedResolver.java @@ -19,7 +19,6 @@ package org.apache.hadoop.security; import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.Locale; import java.util.Map; import java.util.TreeMap; @@ -139,8 +138,7 @@ public class WhitelistBasedResolver extends SaslPropertiesResolver { QualityOfProtection.PRIVACY.toString()); for (int i=0; i < qop.length; i++) { - qop[i] = QualityOfProtection.valueOf( - qop[i].toUpperCase(Locale.ENGLISH)).getSaslQop(); + qop[i] = QualityOfProtection.valueOf(qop[i].toUpperCase()).getSaslQop(); } saslProps.put(Sasl.QOP, StringUtils.join(",", qop)); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java index 50f96d6093c..4b81e170955 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java @@ -33,7 +33,6 @@ import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.text.MessageFormat; -import java.util.Locale; /** * {@link KeyStoresFactory} implementation that reads the certificates from @@ -95,8 +94,7 @@ public class FileBasedKeyStoresFactory implements KeyStoresFactory { @VisibleForTesting public static String resolvePropertyName(SSLFactory.Mode mode, String template) { - return MessageFormat.format( - template, mode.toString().toLowerCase(Locale.ENGLISH)); + return MessageFormat.format(template, mode.toString().toLowerCase()); } /** diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java index 370f09f898e..bbea33b7a09 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java @@ -33,7 +33,6 @@ import javax.net.ssl.SSLSocketFactory; import java.io.IOException; import java.net.HttpURLConnection; import java.security.GeneralSecurityException; -import java.util.Locale; /** * Factory that creates SSLEngine and SSLSocketFactory instances using @@ -139,7 +138,7 @@ public class SSLFactory implements ConnectionConfigurator { private HostnameVerifier getHostnameVerifier(Configuration conf) throws GeneralSecurityException, IOException { return getHostnameVerifier(conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT"). - trim().toUpperCase(Locale.ENGLISH)); + trim().toUpperCase()); } public static HostnameVerifier getHostnameVerifier(String verifier) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java index 7a905f1dae6..dd5e67b48bc 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java @@ -41,7 +41,6 @@ import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; @@ -366,7 +365,7 @@ public interface SSLHostnameVerifier extends javax.net.ssl.HostnameVerifier { buf.append('<'); for (int i = 0; i < hosts.length; i++) { String h = hosts[i]; - h = h != null ? h.trim().toLowerCase(Locale.ENGLISH) : ""; + h = h != null ? h.trim().toLowerCase() : ""; hosts[i] = h; if (i > 0) { buf.append('/'); @@ -407,7 +406,7 @@ public interface SSLHostnameVerifier extends javax.net.ssl.HostnameVerifier { out: for (Iterator it = names.iterator(); it.hasNext();) { // Don't trim the CN, though! - final String cn = it.next().toLowerCase(Locale.ENGLISH); + final String cn = it.next().toLowerCase(); // Store CN in StringBuffer in case we need to report an error. buf.append(" <"); buf.append(cn); @@ -425,8 +424,7 @@ public interface SSLHostnameVerifier extends javax.net.ssl.HostnameVerifier { acceptableCountryWildcard(cn); for (int i = 0; i < hosts.length; i++) { - final String hostName = - hosts[i].trim().toLowerCase(Locale.ENGLISH); + final String hostName = hosts[i].trim().toLowerCase(); if (doWildcard) { match = hostName.endsWith(cn.substring(1)); if (match && strictWithSubDomains) { @@ -481,7 +479,7 @@ public interface SSLHostnameVerifier extends javax.net.ssl.HostnameVerifier { } public static boolean isLocalhost(String host) { - host = host != null ? host.trim().toLowerCase(Locale.ENGLISH) : ""; + host = host != null ? host.trim().toLowerCase() : ""; if (host.startsWith("::1")) { int x = host.lastIndexOf('%'); if (x >= 0) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationHandler.java index f1bcd5dc546..c18b5d32cf5 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationHandler.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationHandler.java @@ -23,7 +23,6 @@ import java.text.MessageFormat; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; -import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -170,7 +169,7 @@ public abstract class DelegationTokenAuthenticationHandler boolean requestContinues = true; String op = ServletUtils.getParameter(request, KerberosDelegationTokenAuthenticator.OP_PARAM); - op = (op != null) ? op.toUpperCase(Locale.ENGLISH) : null; + op = (op != null) ? op.toUpperCase() : null; if (DELEGATION_TOKEN_OPS.contains(op) && !request.getMethod().equals("OPTIONS")) { KerberosDelegationTokenAuthenticator.DelegationTokenOperation dtOp = diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticator.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticator.java index 5d826b77350..d93f7acf6c8 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticator.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticator.java @@ -37,7 +37,6 @@ import java.net.InetSocketAddress; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; -import java.util.Locale; import java.util.Map; /** @@ -287,8 +286,8 @@ public abstract class DelegationTokenAuthenticator implements Authenticator { HttpExceptionUtils.validateResponse(conn, HttpURLConnection.HTTP_OK); if (hasResponse) { String contentType = conn.getHeaderField(CONTENT_TYPE); - contentType = (contentType != null) ? - contentType.toLowerCase(Locale.ENGLISH) : null; + contentType = (contentType != null) ? contentType.toLowerCase() + : null; if (contentType != null && contentType.contains(APPLICATION_JSON_MIME)) { try { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java index c1acc7e4366..ff8edc389df 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java @@ -901,7 +901,7 @@ public class StringUtils { */ public static String camelize(String s) { StringBuilder sb = new StringBuilder(); - String[] words = split(s.toLowerCase(Locale.ENGLISH), ESCAPE_CHAR, '_'); + String[] words = split(s.toLowerCase(Locale.US), ESCAPE_CHAR, '_'); for (String word : words) sb.append(org.apache.commons.lang.StringUtils.capitalize(word)); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java index e52cb2657ee..eb19f48e632 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java @@ -43,7 +43,6 @@ import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Locale; import java.util.Random; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CountDownLatch; @@ -1297,7 +1296,7 @@ public class TestIPC { StringBuilder hexString = new StringBuilder(); - for (String line : hexdump.toUpperCase(Locale.ENGLISH).split("\n")) { + for (String line : hexdump.toUpperCase().split("\n")) { hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", "")); } return StringUtils.hexStringToByte(hexString.toString()); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestSaslRPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestSaslRPC.java index 9b25b77b1d8..903990b78a2 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestSaslRPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestSaslRPC.java @@ -41,7 +41,6 @@ import java.security.Security; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.regex.Pattern; @@ -182,7 +181,7 @@ public class TestSaslRPC { StringBuilder sb = new StringBuilder(); int i = 0; for (QualityOfProtection qop:qops){ - sb.append(qop.name().toLowerCase(Locale.ENGLISH)); + sb.append(qop.name().toLowerCase()); if (++i < qops.length){ sb.append(","); } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java index 1d68f8af575..4616c9071df 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java @@ -103,13 +103,13 @@ public class TestSecurityUtil { String realm = "@REALM"; String principalInConf = service + SecurityUtil.HOSTNAME_PATTERN + realm; String hostname = "FooHost"; - String principal = service + hostname.toLowerCase(Locale.ENGLISH) + realm; + String principal = service + hostname.toLowerCase() + realm; verify(principalInConf, hostname, principal); } @Test public void testLocalHostNameForNullOrWild() throws Exception { - String local = SecurityUtil.getLocalHostName().toLowerCase(Locale.ENGLISH); + String local = SecurityUtil.getLocalHostName().toLowerCase(Locale.US); assertEquals("hdfs/" + local + "@REALM", SecurityUtil.getServerPrincipal("hdfs/_HOST@REALM", (String)null)); assertEquals("hdfs/" + local + "@REALM", @@ -260,7 +260,7 @@ public class TestSecurityUtil { //LOG.info("address:"+addr+" host:"+host+" ip:"+ip+" port:"+port); SecurityUtil.setTokenServiceUseIp(useIp); - String serviceHost = useIp ? ip : host.toLowerCase(Locale.ENGLISH); + String serviceHost = useIp ? ip : host.toLowerCase(); Token token = new Token(); Text service = new Text(serviceHost+":"+port); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java index d77d9b5c658..48b9b99928c 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java @@ -41,7 +41,6 @@ import java.security.PrivilegedExceptionAction; import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.LinkedHashSet; -import java.util.Locale; import java.util.Set; import static org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS; @@ -214,7 +213,7 @@ public class TestUserGroupInformation { userName = userName.substring(sp + 1); } // user names are case insensitive on Windows. Make consistent - userName = userName.toLowerCase(Locale.ENGLISH); + userName = userName.toLowerCase(); } // get the groups pp = Runtime.getRuntime().exec(Shell.WINDOWS ? @@ -234,7 +233,7 @@ public class TestUserGroupInformation { String loginUserName = login.getShortUserName(); if(Shell.WINDOWS) { // user names are case insensitive on Windows. Make consistent - loginUserName = loginUserName.toLowerCase(Locale.ENGLISH); + loginUserName = loginUserName.toLowerCase(); } assertEquals(userName, loginUserName); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java index 4ebf29a9700..220ab1daea8 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java @@ -27,7 +27,6 @@ import java.lang.management.ThreadMXBean; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Locale; import java.util.Map; import org.junit.runner.notification.Failure; @@ -94,8 +93,7 @@ public class TimedOutTestsListener extends RunListener { thread.getPriority(), thread.getId(), Thread.State.WAITING.equals(thread.getState()) ? - "in Object.wait()" : - thread.getState().name().toLowerCase(Locale.ENGLISH), + "in Object.wait()" : thread.getState().name().toLowerCase(), Thread.State.WAITING.equals(thread.getState()) ? "WAITING (on object monitor)" : thread.getState())); for (StackTraceElement stackTraceElement : e.getValue()) { diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestWinUtils.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestWinUtils.java index 708fc4c2403..2d4e4420462 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestWinUtils.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestWinUtils.java @@ -27,7 +27,6 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; -import java.util.Locale; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; @@ -383,10 +382,8 @@ public class TestWinUtils { private void assertOwners(File file, String expectedUser, String expectedGroup) throws IOException { String [] args = lsF(file).trim().split("[\\|]"); - assertEquals(expectedUser.toLowerCase(Locale.ENGLISH), - args[2].toLowerCase(Locale.ENGLISH)); - assertEquals(expectedGroup.toLowerCase(Locale.ENGLISH), - args[3].toLowerCase(Locale.ENGLISH)); + assertEquals(expectedUser.toLowerCase(), args[2].toLowerCase()); + assertEquals(expectedGroup.toLowerCase(), args[3].toLowerCase()); } @Test (timeout = 30000) diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java index cef8f99ae8a..b617ae5088d 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java @@ -20,7 +20,6 @@ package org.apache.hadoop.nfs; import java.net.InetAddress; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.regex.Pattern; import org.apache.commons.logging.Log; @@ -360,10 +359,10 @@ public class NfsExports { AccessPrivilege privilege = AccessPrivilege.READ_ONLY; switch (parts.length) { case 1: - host = parts[0].toLowerCase(Locale.ENGLISH).trim(); + host = parts[0].toLowerCase().trim(); break; case 2: - host = parts[0].toLowerCase(Locale.ENGLISH).trim(); + host = parts[0].toLowerCase().trim(); String option = parts[1].trim(); if ("rw".equalsIgnoreCase(option)) { privilege = AccessPrivilege.READ_WRITE; diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/CheckUploadContentTypeFilter.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/CheckUploadContentTypeFilter.java index 7074ba28bf8..836b4ce9ffd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/CheckUploadContentTypeFilter.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/CheckUploadContentTypeFilter.java @@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashSet; -import java.util.Locale; import java.util.Set; /** @@ -83,8 +82,7 @@ public class CheckUploadContentTypeFilter implements Filter { String method = httpReq.getMethod(); if (method.equals("PUT") || method.equals("POST")) { String op = httpReq.getParameter(HttpFSFileSystem.OP_PARAM); - if (op != null && - UPLOAD_OPERATIONS.contains(op.toUpperCase(Locale.ENGLISH))) { + if (op != null && UPLOAD_OPERATIONS.contains(op.toUpperCase())) { if ("true".equalsIgnoreCase(httpReq.getParameter(HttpFSParametersProvider.DataParam.NAME))) { String contentType = httpReq.getContentType(); contentTypeOK = diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java index bc290a20ada..633589cd468 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java @@ -43,7 +43,6 @@ import java.io.OutputStream; import java.util.EnumSet; import java.util.LinkedHashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Map.Entry; @@ -569,8 +568,7 @@ public class FSOperations { @Override public JSONObject execute(FileSystem fs) throws IOException { boolean deleted = fs.delete(path, recursive); - return toJSON( - HttpFSFileSystem.DELETE_JSON.toLowerCase(Locale.ENGLISH), deleted); + return toJSON(HttpFSFileSystem.DELETE_JSON.toLowerCase(), deleted); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSParametersProvider.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSParametersProvider.java index 73853c41dec..271f3d9f00a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSParametersProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSParametersProvider.java @@ -33,7 +33,6 @@ import org.apache.hadoop.lib.wsrs.StringParam; import javax.ws.rs.ext.Provider; import java.util.HashMap; -import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; @@ -169,8 +168,7 @@ public class HttpFSParametersProvider extends ParametersProvider { */ public OperationParam(String operation) { super(NAME, HttpFSFileSystem.Operation.class, - HttpFSFileSystem.Operation.valueOf( - operation.toUpperCase(Locale.ENGLISH))); + HttpFSFileSystem.Operation.valueOf(operation.toUpperCase())); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java index e2ef7a18142..5c1bb4f7278 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java @@ -36,7 +36,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Properties; @@ -203,7 +202,7 @@ public class Server { * @param config server configuration. */ public Server(String name, String homeDir, String configDir, String logDir, String tempDir, Configuration config) { - this.name = Check.notEmpty(name, "name").trim().toLowerCase(Locale.ENGLISH); + this.name = Check.notEmpty(name, "name").trim().toLowerCase(); this.homeDir = Check.notEmpty(homeDir, "homeDir"); this.configDir = Check.notEmpty(configDir, "configDir"); this.logDir = Check.notEmpty(logDir, "logDir"); diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java index fd2e822ac33..ccb15a30bab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java @@ -43,7 +43,6 @@ import java.net.URI; import java.security.PrivilegedExceptionAction; import java.util.Collection; import java.util.HashSet; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -255,7 +254,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc private Set toLowerCase(Collection collection) { Set set = new HashSet(); for (String value : collection) { - set.add(value.toLowerCase(Locale.ENGLISH)); + set.add(value.toLowerCase()); } return set; } @@ -301,7 +300,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc protected void validateNamenode(String namenode) throws FileSystemAccessException { if (nameNodeWhitelist.size() > 0 && !nameNodeWhitelist.contains("*")) { - if (!nameNodeWhitelist.contains(namenode.toLowerCase(Locale.ENGLISH))) { + if (!nameNodeWhitelist.contains(namenode.toLowerCase())) { throw new FileSystemAccessException(FileSystemAccessException.ERROR.H05, namenode, "not in whitelist"); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumParam.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumParam.java index 08eb60d9575..8baef67e8ca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumParam.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumParam.java @@ -22,7 +22,6 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.util.StringUtils; import java.util.Arrays; -import java.util.Locale; @InterfaceAudience.Private public abstract class EnumParam> extends Param { @@ -35,7 +34,7 @@ public abstract class EnumParam> extends Param { @Override protected E parse(String str) throws Exception { - return Enum.valueOf(klass, str.toUpperCase(Locale.ENGLISH)); + return Enum.valueOf(klass, str.toUpperCase()); } @Override diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumSetParam.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumSetParam.java index 25158fd986b..8d79b71886f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumSetParam.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/EnumSetParam.java @@ -20,7 +20,6 @@ package org.apache.hadoop.lib.wsrs; import java.util.Arrays; import java.util.EnumSet; import java.util.Iterator; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience; @@ -38,7 +37,7 @@ public abstract class EnumSetParam> extends Param> final EnumSet set = EnumSet.noneOf(klass); if (!str.isEmpty()) { for (String sub : str.split(",")) { - set.add(Enum.valueOf(klass, sub.trim().toUpperCase(Locale.ENGLISH))); + set.add(Enum.valueOf(klass, sub.trim().toUpperCase())); } } return set; diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java index 9857244bd0d..4703a904a12 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java @@ -33,7 +33,6 @@ import java.lang.reflect.Type; import java.text.MessageFormat; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; /** @@ -71,7 +70,7 @@ public class ParametersProvider } Enum op; try { - op = Enum.valueOf(enumClass, str.toUpperCase(Locale.ENGLISH)); + op = Enum.valueOf(enumClass, str.toUpperCase()); } catch (IllegalArgumentException ex) { throw new IllegalArgumentException( MessageFormat.format("Invalid Operation [{0}]", str)); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/XAttrHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/XAttrHelper.java index 1b5b8eb9785..04364ccf7e7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/XAttrHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/XAttrHelper.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hdfs; import java.util.List; -import java.util.Locale; import java.util.Map; import org.apache.hadoop.HadoopIllegalArgumentException; @@ -58,22 +57,16 @@ public class XAttrHelper { } NameSpace ns; - final String prefix = name.substring(0, prefixIndex) - .toLowerCase(Locale.ENGLISH); - if (prefix.equals( - NameSpace.USER.toString().toLowerCase(Locale.ENGLISH))) { + final String prefix = name.substring(0, prefixIndex).toLowerCase(); + if (prefix.equals(NameSpace.USER.toString().toLowerCase())) { ns = NameSpace.USER; - } else if (prefix.equals( - NameSpace.TRUSTED.toString().toLowerCase(Locale.ENGLISH))) { + } else if (prefix.equals(NameSpace.TRUSTED.toString().toLowerCase())) { ns = NameSpace.TRUSTED; - } else if (prefix.equals( - NameSpace.SYSTEM.toString().toLowerCase(Locale.ENGLISH))) { + } else if (prefix.equals(NameSpace.SYSTEM.toString().toLowerCase())) { ns = NameSpace.SYSTEM; - } else if (prefix.equals( - NameSpace.SECURITY.toString().toLowerCase(Locale.ENGLISH))) { + } else if (prefix.equals(NameSpace.SECURITY.toString().toLowerCase())) { ns = NameSpace.SECURITY; - } else if (prefix.equals( - NameSpace.RAW.toString().toLowerCase(Locale.ENGLISH))) { + } else if (prefix.equals(NameSpace.RAW.toString().toLowerCase())) { ns = NameSpace.RAW; } else { throw new HadoopIllegalArgumentException("An XAttr name must be " + @@ -152,7 +145,7 @@ public class XAttrHelper { } String namespace = xAttr.getNameSpace().toString(); - return namespace.toLowerCase(Locale.ENGLISH) + "." + xAttr.getName(); + return namespace.toLowerCase() + "." + xAttr.getName(); } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java index 1769794953d..54da8ebe8d4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hdfs.protocol; import java.util.HashMap; -import java.util.Locale; import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience; @@ -99,7 +98,7 @@ public class HdfsConstants { /** Covert the given String to a RollingUpgradeAction. */ public static RollingUpgradeAction fromString(String s) { - return MAP.get(s.toUpperCase(Locale.ENGLISH)); + return MAP.get(s.toUpperCase()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java index 9d8bdb5d0dd..0c03a42712f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java @@ -30,7 +30,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; -import java.util.Locale; /** A collection of block storage policies. */ public class BlockStoragePolicySuite { @@ -132,8 +131,7 @@ public class BlockStoragePolicySuite { } public static String buildXAttrName() { - return XAttrNS.toString().toLowerCase(Locale.ENGLISH) + "." - + STORAGE_POLICY_XATTR_NAME; + return XAttrNS.toString().toLowerCase() + "." + STORAGE_POLICY_XATTR_NAME; } public static XAttr buildXAttr(byte policyId) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java index 3674d2c5747..9bba2c950b8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.server.common; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -54,7 +53,7 @@ public final class HdfsServerConstants { public String getOptionString() { return StartupOption.ROLLINGUPGRADE.getName() + " " - + name().toLowerCase(Locale.ENGLISH); + + name().toLowerCase(); } public boolean matches(StartupOption option) { @@ -77,7 +76,7 @@ public final class HdfsServerConstants { public static String getAllOptionString() { final StringBuilder b = new StringBuilder("<"); for(RollingUpgradeStartupOption opt : VALUES) { - b.append(opt.name().toLowerCase(Locale.ENGLISH)).append("|"); + b.append(opt.name().toLowerCase()).append("|"); } b.setCharAt(b.length() - 1, '>'); return b.toString(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java index 1a553c99294..7cda670f222 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hdfs.server.datanode; -import java.util.Locale; import java.util.regex.Pattern; import java.io.File; @@ -89,8 +88,7 @@ public class StorageLocation { String classString = matcher.group(1); location = matcher.group(2); if (!classString.isEmpty()) { - storageType = StorageType.valueOf( - classString.toUpperCase(Locale.ENGLISH)); + storageType = StorageType.valueOf(classString.toUpperCase()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java index d9ec54379e6..c41a46a8803 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java @@ -75,7 +75,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumMap; -import java.util.Locale; import java.util.List; import java.util.zip.CheckedInputStream; import java.util.zip.Checksum; @@ -4349,7 +4348,7 @@ public abstract class FSEditLogOp { public RollingUpgradeOp(FSEditLogOpCodes code, String name) { super(code); - this.name = name.toUpperCase(Locale.ENGLISH); + this.name = name.toUpperCase(); } static RollingUpgradeOp getStartInstance(OpInstanceCache cache) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaByStorageTypeEntry.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaByStorageTypeEntry.java index 7059c64f68c..d115acc5f34 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaByStorageTypeEntry.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/QuotaByStorageTypeEntry.java @@ -18,8 +18,7 @@ package org.apache.hadoop.hdfs.server.namenode; import com.google.common.base.Objects; -import org.apache.hadoop.fs.StorageType; -import java.util.Locale; +import org.apache.hadoop.hdfs.StorageType; public class QuotaByStorageTypeEntry { private StorageType type; @@ -54,7 +53,7 @@ import java.util.Locale; public String toString() { StringBuilder sb = new StringBuilder(); assert (type != null); - sb.append(type.toString().toLowerCase(Locale.ENGLISH)); + sb.append(type.toString().toLowerCase()); sb.append(':'); sb.append(quota); return sb.toString(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java index 1157bb89bac..83e6426a30c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java @@ -587,7 +587,7 @@ public class SecondaryNameNode implements Runnable, return 0; } - String cmd = opts.getCommand().toString().toLowerCase(Locale.ENGLISH); + String cmd = opts.getCommand().toString().toLowerCase(); int exitCode = 0; try { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/GetConf.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/GetConf.java index c380901a3d1..92a16cd282b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/GetConf.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/GetConf.java @@ -24,7 +24,6 @@ import java.security.PrivilegedExceptionAction; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import org.apache.hadoop.HadoopIllegalArgumentException; @@ -80,19 +79,19 @@ public class GetConf extends Configured implements Tool { private static final Map map; static { map = new HashMap(); - map.put(NAMENODE.getName().toLowerCase(Locale.ENGLISH), + map.put(NAMENODE.getName().toLowerCase(), new NameNodesCommandHandler()); - map.put(SECONDARY.getName().toLowerCase(Locale.ENGLISH), + map.put(SECONDARY.getName().toLowerCase(), new SecondaryNameNodesCommandHandler()); - map.put(BACKUP.getName().toLowerCase(Locale.ENGLISH), + map.put(BACKUP.getName().toLowerCase(), new BackupNodesCommandHandler()); - map.put(INCLUDE_FILE.getName().toLowerCase(Locale.ENGLISH), + map.put(INCLUDE_FILE.getName().toLowerCase(), new CommandHandler(DFSConfigKeys.DFS_HOSTS)); - map.put(EXCLUDE_FILE.getName().toLowerCase(Locale.ENGLISH), + map.put(EXCLUDE_FILE.getName().toLowerCase(), new CommandHandler(DFSConfigKeys.DFS_HOSTS_EXCLUDE)); - map.put(NNRPCADDRESSES.getName().toLowerCase(Locale.ENGLISH), + map.put(NNRPCADDRESSES.getName().toLowerCase(), new NNRpcAddressesCommandHandler()); - map.put(CONFKEY.getName().toLowerCase(Locale.ENGLISH), + map.put(CONFKEY.getName().toLowerCase(), new PrintConfKeyCommandHandler()); } @@ -117,7 +116,7 @@ public class GetConf extends Configured implements Tool { } public static CommandHandler getHandler(String cmd) { - return map.get(cmd.toLowerCase(Locale.ENGLISH)); + return map.get(cmd.toLowerCase()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsVisitorFactory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsVisitorFactory.java index aa542d3f25a..c4b8424571a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsVisitorFactory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsVisitorFactory.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.tools.offlineEditsViewer; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; @@ -44,7 +43,7 @@ public class OfflineEditsVisitorFactory { */ static public OfflineEditsVisitor getEditsVisitor(String filename, String processor, boolean printToScreen) throws IOException { - if(processor.toLowerCase(Locale.ENGLISH).equals("binary")) { + if(processor.toLowerCase().equals("binary")) { return new BinaryEditsVisitor(filename); } OfflineEditsVisitor vis; @@ -60,9 +59,9 @@ public class OfflineEditsVisitorFactory { outs[1] = System.out; out = new TeeOutputStream(outs); } - if(processor.toLowerCase(Locale.ENGLISH).equals("xml")) { + if(processor.toLowerCase().equals("xml")) { vis = new XmlEditsVisitor(out); - } else if(processor.toLowerCase(Locale.ENGLISH).equals("stats")) { + } else if(processor.toLowerCase().equals("stats")) { vis = new StatisticsEditsVisitor(out); } else { throw new IOException("Unknown proccesor " + processor + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/FSImageHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/FSImageHandler.java index aa365162f52..43fcd69a839 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/FSImageHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/FSImageHandler.java @@ -37,7 +37,6 @@ import org.apache.hadoop.hdfs.web.JsonUtil; import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; -import java.util.Locale; import java.util.Map; import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION; @@ -142,7 +141,7 @@ class FSImageHandler extends SimpleChannelInboundHandler { private static String getOp(QueryStringDecoder decoder) { Map> parameters = decoder.parameters(); return parameters.containsKey("op") - ? parameters.get("op").get(0).toUpperCase(Locale.ENGLISH) : null; + ? parameters.get("op").get(0).toUpperCase() : null; } private static String getPath(QueryStringDecoder decoder) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/AuthFilter.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/AuthFilter.java index 1a0aaebedd3..b6ff4b656d5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/AuthFilter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/AuthFilter.java @@ -23,7 +23,6 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Properties; @@ -97,7 +96,7 @@ public class AuthFilter extends AuthenticationFilter { final Map> m = new HashMap>(); for(Map.Entry entry : original.entrySet()) { - final String key = entry.getKey().toLowerCase(Locale.ENGLISH); + final String key = entry.getKey().toLowerCase(); List strings = m.get(key); if (strings == null) { strings = new ArrayList(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/ParamFilter.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/ParamFilter.java index 6a18377d2c2..2ae3445691f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/ParamFilter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/ParamFilter.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hdfs.web; import java.net.URI; import java.util.List; -import java.util.Locale; import java.util.Map; import javax.ws.rs.core.MultivaluedMap; @@ -76,7 +75,7 @@ public class ParamFilter implements ResourceFilter { final MultivaluedMap parameters) { UriBuilder b = UriBuilder.fromUri(uri).replaceQuery(""); for(Map.Entry> e : parameters.entrySet()) { - final String key = e.getKey().toLowerCase(Locale.ENGLISH); + final String key = e.getKey().toLowerCase(); for(String v : e.getValue()) { b = b.queryParam(key, v); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java index b1026c02e8c..938f7c77f64 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java @@ -32,7 +32,6 @@ import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; @@ -1243,7 +1242,7 @@ public class WebHdfsFileSystem extends FileSystem if (query == null) { return url; } - final String lower = query.toLowerCase(Locale.ENGLISH); + final String lower = query.toLowerCase(); if (!lower.startsWith(OFFSET_PARAM_PREFIX) && !lower.contains("&" + OFFSET_PARAM_PREFIX)) { return url; @@ -1254,7 +1253,7 @@ public class WebHdfsFileSystem extends FileSystem for(final StringTokenizer st = new StringTokenizer(query, "&"); st.hasMoreTokens();) { final String token = st.nextToken(); - if (!token.toLowerCase(Locale.ENGLISH).startsWith(OFFSET_PARAM_PREFIX)) { + if (!token.toLowerCase().startsWith(OFFSET_PARAM_PREFIX)) { if (b == null) { b = new StringBuilder("?").append(token); } else { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumParam.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumParam.java index 6b4ec2ca5bd..1703e3b25d6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumParam.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumParam.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hdfs.web.resources; import java.util.Arrays; -import java.util.Locale; abstract class EnumParam> extends Param> { EnumParam(final Domain domain, final E value) { @@ -41,7 +40,7 @@ abstract class EnumParam> extends Param @Override final E parse(final String str) { - return Enum.valueOf(enumClass, str.toUpperCase(Locale.ENGLISH)); + return Enum.valueOf(enumClass, str.toUpperCase()); } } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java index 23ba16ce652..5adb5a6fc2f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.web.resources; import java.util.Arrays; import java.util.EnumSet; import java.util.Iterator; -import java.util.Locale; abstract class EnumSetParam> extends Param, EnumSetParam.Domain> { /** Convert an EnumSet to a string of comma separated values. */ @@ -83,8 +82,7 @@ abstract class EnumSetParam> extends Param, EnumSet i = j > 0 ? j + 1 : 0; j = str.indexOf(',', i); final String sub = j >= 0? str.substring(i, j): str.substring(i); - set.add( - Enum.valueOf(enumClass, sub.trim().toUpperCase(Locale.ENGLISH))); + set.add(Enum.valueOf(enumClass, sub.trim().toUpperCase())); } } return set; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotManager.java index db8f2907a84..ac6acf90b6b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotManager.java @@ -25,7 +25,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import java.util.ArrayList; -import java.util.Locale; import org.apache.hadoop.hdfs.protocol.SnapshotException; import org.apache.hadoop.hdfs.server.namenode.FSDirectory; @@ -71,7 +70,7 @@ public class TestSnapshotManager { Assert.fail("Expected SnapshotException not thrown"); } catch (SnapshotException se) { Assert.assertTrue( - se.getMessage().toLowerCase(Locale.ENGLISH).contains("rollover")); + se.getMessage().toLowerCase().contains("rollover")); } // Delete a snapshot to free up a slot. @@ -87,7 +86,7 @@ public class TestSnapshotManager { Assert.fail("Expected SnapshotException not thrown"); } catch (SnapshotException se) { Assert.assertTrue( - se.getMessage().toLowerCase(Locale.ENGLISH).contains("rollover")); + se.getMessage().toLowerCase().contains("rollover")); } } } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java index ca204a69e34..aad63d31588 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java @@ -23,7 +23,6 @@ import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; -import java.util.Locale; import java.util.Map; import java.util.Timer; import java.util.TimerTask; @@ -712,8 +711,7 @@ public class JobHistoryEventHandler extends AbstractService private void processEventForTimelineServer(HistoryEvent event, JobId jobId, long timestamp) { TimelineEvent tEvent = new TimelineEvent(); - tEvent.setEventType( - event.getEventType().name().toUpperCase(Locale.ENGLISH)); + tEvent.setEventType(event.getEventType().name().toUpperCase()); tEvent.setTimestamp(timestamp); TimelineEntity tEntity = new TimelineEntity(); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java index 440ff490cb6..53f21db12d1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java @@ -227,7 +227,7 @@ public class AppController extends Controller implements AMParams { try { String tt = $(TASK_TYPE); tt = tt.isEmpty() ? "All" : StringUtils.capitalize(MRApps.taskType(tt). - toString().toLowerCase(Locale.ENGLISH)); + toString().toLowerCase(Locale.US)); setTitle(join(tt, " Tasks for ", $(JOB_ID))); } catch (Exception e) { LOG.error("Failed to render tasks page with task type : " diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java index e0c4773dcd0..553ba707a0c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java @@ -21,7 +21,6 @@ package org.apache.hadoop.mapreduce; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Locale; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapred.JobPriority; @@ -315,7 +314,7 @@ public class TypeConverter { QueueState state) { org.apache.hadoop.mapreduce.QueueState qState = org.apache.hadoop.mapreduce.QueueState.getState( - state.toString().toLowerCase(Locale.ENGLISH)); + state.toString().toLowerCase()); return qState; } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java index 37cfb7a91cb..08b44f8617b 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java @@ -30,7 +30,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import com.google.common.annotations.VisibleForTesting; @@ -304,7 +303,7 @@ public class MRApps extends Apps { remoteFS.getWorkingDirectory())); String name = (null == u.getFragment()) ? p.getName() : u.getFragment(); - if (!name.toLowerCase(Locale.ENGLISH).endsWith(".jar")) { + if (!name.toLowerCase().endsWith(".jar")) { linkLookup.put(p, name); } } @@ -318,7 +317,7 @@ public class MRApps extends Apps { if (name == null) { name = p.getName(); } - if(!name.toLowerCase(Locale.ENGLISH).endsWith(".jar")) { + if(!name.toLowerCase().endsWith(".jar")) { MRApps.addToEnvironment( environment, classpathEnvVar, diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/TestTypeConverter.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/TestTypeConverter.java index d3608110328..cc42b9c220f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/TestTypeConverter.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/TestTypeConverter.java @@ -22,7 +22,6 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.JobStatus.State; @@ -154,8 +153,7 @@ public class TestTypeConverter { org.apache.hadoop.mapreduce.QueueInfo returned = TypeConverter.fromYarn(queueInfo, new Configuration()); Assert.assertEquals("queueInfo translation didn't work.", - returned.getState().toString(), - queueInfo.getQueueState().toString().toLowerCase(Locale.ENGLISH)); + returned.getState().toString(), queueInfo.getQueueState().toString().toLowerCase()); } /** diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java index 73dab4f27a8..5274438782c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java @@ -28,7 +28,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicBoolean; @@ -117,7 +116,7 @@ abstract public class Task implements Writable, Configurable { * BYTES_READ counter and second one is of the BYTES_WRITTEN counter. */ protected static String[] getFileSystemCounterNames(String uriScheme) { - String scheme = uriScheme.toUpperCase(Locale.ENGLISH); + String scheme = uriScheme.toUpperCase(); return new String[]{scheme+"_BYTES_READ", scheme+"_BYTES_WRITTEN"}; } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java index e8d5d1de7f4..a53b76a3c46 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java @@ -227,7 +227,7 @@ public abstract class FileSystemCounterGroup } private String checkScheme(String scheme) { - String fixed = scheme.toUpperCase(Locale.ENGLISH); + String fixed = scheme.toUpperCase(Locale.US); String interned = schemes.putIfAbsent(fixed, fixed); if (schemes.size() > MAX_NUM_SCHEMES) { // mistakes or abuses diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/filecache/DistributedCache.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/filecache/DistributedCache.java index ef9b0a485e4..eaa5af8672d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/filecache/DistributedCache.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/filecache/DistributedCache.java @@ -473,7 +473,7 @@ public class DistributedCache { if (fragment == null) { return false; } - String lowerCaseFragment = fragment.toLowerCase(Locale.ENGLISH); + String lowerCaseFragment = fragment.toLowerCase(); if (fragments.contains(lowerCaseFragment)) { return false; } @@ -488,7 +488,7 @@ public class DistributedCache { if (fragment == null) { return false; } - String lowerCaseFragment = fragment.toLowerCase(Locale.ENGLISH); + String lowerCaseFragment = fragment.toLowerCase(); if (fragments.contains(lowerCaseFragment)) { return false; } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/db/DBInputFormat.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/db/DBInputFormat.java index 7faa736e409..00fbeda09af 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/db/DBInputFormat.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/db/DBInputFormat.java @@ -29,7 +29,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -163,8 +162,7 @@ public class DBInputFormat this.connection = createConnection(); DatabaseMetaData dbMeta = connection.getMetaData(); - this.dbProductName = - dbMeta.getDatabaseProductName().toUpperCase(Locale.ENGLISH); + this.dbProductName = dbMeta.getDatabaseProductName().toUpperCase(); } catch (Exception ex) { throw new RuntimeException(ex); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java index 6af815b41a6..37ba5b71191 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java @@ -22,7 +22,6 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.HashSet; import java.util.Arrays; @@ -223,12 +222,12 @@ public class CLI extends Configured implements Tool { taskType = argv[2]; taskState = argv[3]; displayTasks = true; - if (!taskTypes.contains(taskType.toUpperCase(Locale.ENGLISH))) { + if (!taskTypes.contains(taskType.toUpperCase())) { System.out.println("Error: Invalid task-type: " + taskType); displayUsage(cmd); return exitCode; } - if (!taskStates.contains(taskState.toLowerCase(Locale.ENGLISH))) { + if (!taskStates.contains(taskState.toLowerCase())) { System.out.println("Error: Invalid task-state: " + taskState); displayUsage(cmd); return exitCode; @@ -594,8 +593,7 @@ public class CLI extends Configured implements Tool { throws IOException, InterruptedException { TaskReport[] reports=null; - reports = job.getTaskReports( - TaskType.valueOf(type.toUpperCase(Locale.ENGLISH))); + reports = job.getTaskReports(TaskType.valueOf(type.toUpperCase())); for (TaskReport report : reports) { TIPStatus status = report.getCurrentStatus(); if ((state.equalsIgnoreCase("pending") && status ==TIPStatus.PENDING) || diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java index 94204977b95..d9cd07ba051 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java @@ -29,7 +29,6 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; import java.util.Date; -import java.util.Locale; import java.util.Random; import java.util.StringTokenizer; import org.apache.commons.logging.Log; @@ -155,16 +154,16 @@ public class TestDFSIO implements Tool { static ByteMultiple parseString(String sMultiple) { if(sMultiple == null || sMultiple.isEmpty()) // MB by default return MB; - String sMU = sMultiple.toUpperCase(Locale.ENGLISH); - if(B.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) + String sMU = sMultiple.toUpperCase(); + if(B.name().toUpperCase().endsWith(sMU)) return B; - if(KB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) + if(KB.name().toUpperCase().endsWith(sMU)) return KB; - if(MB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) + if(MB.name().toUpperCase().endsWith(sMU)) return MB; - if(GB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) + if(GB.name().toUpperCase().endsWith(sMU)) return GB; - if(TB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) + if(TB.name().toUpperCase().endsWith(sMU)) return TB; throw new IllegalArgumentException("Unsupported ByteMultiple "+sMultiple); } @@ -737,7 +736,7 @@ public class TestDFSIO implements Tool { } for (int i = 0; i < args.length; i++) { // parse command line - if (args[i].toLowerCase(Locale.ENGLISH).startsWith("-read")) { + if (args[i].toLowerCase().startsWith("-read")) { testType = TestType.TEST_TYPE_READ; } else if (args[i].equalsIgnoreCase("-write")) { testType = TestType.TEST_TYPE_WRITE; @@ -756,10 +755,9 @@ public class TestDFSIO implements Tool { testType = TestType.TEST_TYPE_TRUNCATE; } else if (args[i].equalsIgnoreCase("-clean")) { testType = TestType.TEST_TYPE_CLEANUP; - } else if (args[i].toLowerCase(Locale.ENGLISH).startsWith("-seq")) { + } else if (args[i].toLowerCase().startsWith("-seq")) { isSequential = true; - } else if ( - args[i].toLowerCase(Locale.ENGLISH).startsWith("-compression")) { + } else if (args[i].toLowerCase().startsWith("-compression")) { compressionClass = args[++i]; } else if (args[i].equalsIgnoreCase("-nrfiles")) { nrFiles = Integer.parseInt(args[++i]); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestFileSystem.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestFileSystem.java index e2b8985f0a3..13e27cd9e1c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestFileSystem.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestFileSystem.java @@ -24,7 +24,6 @@ import java.io.OutputStream; import java.security.PrivilegedExceptionAction; import java.util.Arrays; import java.util.Collections; -import java.util.Locale; import java.util.Random; import java.util.List; import java.util.ArrayList; @@ -557,10 +556,7 @@ public class TestFileSystem extends TestCase { static void checkPath(MiniDFSCluster cluster, FileSystem fileSys) throws IOException { InetSocketAddress add = cluster.getNameNode().getNameNodeAddress(); // Test upper/lower case - fileSys.checkPath( - new Path("hdfs://" - + add.getHostName().toUpperCase(Locale.ENGLISH) - + ":" + add.getPort())); + fileSys.checkPath(new Path("hdfs://" + add.getHostName().toUpperCase() + ":" + add.getPort())); } public void testFsClose() throws Exception { diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/Constants.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/Constants.java index be2648e0dea..0642052e0f1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/Constants.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/Constants.java @@ -18,8 +18,6 @@ package org.apache.hadoop.fs.slive; -import java.util.Locale; - /** * Constants used in various places in slive */ @@ -37,7 +35,7 @@ class Constants { enum Distribution { BEG, END, UNIFORM, MID; String lowerName() { - return this.name().toLowerCase(Locale.ENGLISH); + return this.name().toLowerCase(); } } @@ -47,7 +45,7 @@ class Constants { enum OperationType { READ, APPEND, RENAME, LS, MKDIR, DELETE, CREATE, TRUNCATE; String lowerName() { - return this.name().toLowerCase(Locale.ENGLISH); + return this.name().toLowerCase(); } } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationData.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationData.java index 462db86b055..b4c98f7f176 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationData.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationData.java @@ -18,7 +18,6 @@ package org.apache.hadoop.fs.slive; -import java.util.Locale; import org.apache.hadoop.fs.slive.Constants.Distribution; /** @@ -53,8 +52,7 @@ class OperationData { percent = (Double.parseDouble(pieces[0]) / 100.0d); } else if (pieces.length >= 2) { percent = (Double.parseDouble(pieces[0]) / 100.0d); - distribution = - Distribution.valueOf(pieces[1].toUpperCase(Locale.ENGLISH)); + distribution = Distribution.valueOf(pieces[1].toUpperCase()); } } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationOutput.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationOutput.java index d60a607d396..57ef0176a51 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationOutput.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/OperationOutput.java @@ -18,7 +18,6 @@ package org.apache.hadoop.fs.slive; -import java.util.Locale; import org.apache.hadoop.io.Text; /** @@ -68,8 +67,7 @@ class OperationOutput { "Invalid key format - no type seperator - " + TYPE_SEP); } try { - dataType = OutputType.valueOf( - key.substring(0, place).toUpperCase(Locale.ENGLISH)); + dataType = OutputType.valueOf(key.substring(0, place).toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException( "Invalid key format - invalid output type", e); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/SliveTest.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/SliveTest.java index 443089df3e2..ce1837f3afe 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/SliveTest.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/slive/SliveTest.java @@ -27,7 +27,6 @@ import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.TreeMap; @@ -158,7 +157,7 @@ public class SliveTest implements Tool { if (val == null) { return false; } - String cleanupOpt = val.toLowerCase(Locale.ENGLISH).trim(); + String cleanupOpt = val.toLowerCase().trim(); if (cleanupOpt.equals("true") || cleanupOpt.equals("1")) { return true; } else { diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/io/FileBench.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/io/FileBench.java index 0830f373af3..f155daef141 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/io/FileBench.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/io/FileBench.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.EnumSet; import java.util.HashMap; -import java.util.Locale; import java.util.Map; import java.util.Random; @@ -215,25 +214,23 @@ public class FileBench extends Configured implements Tool { if (!(fmt == Format.txt || cod == CCodec.pln)) { for (CType typ : ct) { String fn = - fmt.name().toUpperCase(Locale.ENGLISH) + "_" + - cod.name().toUpperCase(Locale.ENGLISH) + "_" + - typ.name().toUpperCase(Locale.ENGLISH); + fmt.name().toUpperCase() + "_" + + cod.name().toUpperCase() + "_" + + typ.name().toUpperCase(); typ.configure(job); - System.out.print( - rwop.name().toUpperCase(Locale.ENGLISH) + " " + fn + ": "); + System.out.print(rwop.name().toUpperCase() + " " + fn + ": "); System.out.println(rwop.exec(fn, job) / 1000 + " seconds"); } } else { String fn = - fmt.name().toUpperCase(Locale.ENGLISH) + "_" + - cod.name().toUpperCase(Locale.ENGLISH); + fmt.name().toUpperCase() + "_" + + cod.name().toUpperCase(); Path p = new Path(root, fn); if (rwop == RW.r && !fs.exists(p)) { fn += cod.getExt(); } - System.out.print( - rwop.name().toUpperCase(Locale.ENGLISH) + " " + fn + ": "); + System.out.print(rwop.name().toUpperCase() + " " + fn + ": "); System.out.println(rwop.exec(fn, job) / 1000 + " seconds"); } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMapRed.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMapRed.java index b9bbd609ba4..02a083b4f0a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMapRed.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMapRed.java @@ -28,7 +28,6 @@ import java.io.File; import java.util.EnumSet; import java.util.HashSet; import java.util.Iterator; -import java.util.Locale; import java.util.Random; import org.apache.hadoop.conf.Configuration; @@ -281,7 +280,7 @@ public class TestMapRed extends Configured implements Tool { public void map(WritableComparable key, Text value, OutputCollector output, Reporter reporter) throws IOException { - String str = value.toString().toLowerCase(Locale.ENGLISH); + String str = value.toString().toLowerCase(); output.collect(new Text(str), value); } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/DBCountPageView.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/DBCountPageView.java index 4379cd5edc3..270ddc9a558 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/DBCountPageView.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/DBCountPageView.java @@ -27,7 +27,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.Locale; import java.util.Random; import org.apache.commons.logging.Log; @@ -103,7 +102,7 @@ public class DBCountPageView extends Configured implements Tool { private void createConnection(String driverClassName , String url) throws Exception { - if(driverClassName.toLowerCase(Locale.ENGLISH).contains("oracle")) { + if(driverClassName.toLowerCase().contains("oracle")) { isOracle = true; } Class.forName(driverClassName); diff --git a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java index f0ec59c376d..f342463370f 100644 --- a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java +++ b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java @@ -35,7 +35,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; -import java.util.Locale; import java.util.TimeZone; /** @@ -330,8 +329,7 @@ public class VersionInfoMojo extends AbstractMojo { } private String normalizePath(File file) { - return file.getPath().toUpperCase(Locale.ENGLISH) - .replaceAll("\\\\", "/"); + return file.getPath().toUpperCase().replaceAll("\\\\", "/"); } }); byte[] md5 = computeMD5(files); diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java index bd8ca6ef5a6..2412698490c 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java @@ -979,8 +979,8 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore { private String verifyAndConvertToStandardFormat(String rawDir) throws URISyntaxException { URI asUri = new URI(rawDir); if (asUri.getAuthority() == null - || asUri.getAuthority().toLowerCase(Locale.ENGLISH).equalsIgnoreCase( - sessionUri.getAuthority().toLowerCase(Locale.ENGLISH))) { + || asUri.getAuthority().toLowerCase(Locale.US).equalsIgnoreCase( + sessionUri.getAuthority().toLowerCase(Locale.US))) { // Applies to me. return trim(asUri.getPath(), "/"); } else { diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java index 36873c7f94c..71e84a11cc8 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java @@ -121,9 +121,8 @@ public class DistCpUtils { */ public static Class getStrategy(Configuration conf, DistCpOptions options) { - String confLabel = "distcp." - + options.getCopyStrategy().toLowerCase(Locale.ENGLISH) - + ".strategy.impl"; + String confLabel = "distcp." + + options.getCopyStrategy().toLowerCase(Locale.getDefault()) + ".strategy.impl"; return conf.getClass(confLabel, UniformSizeInputFormat.class, InputFormat.class); } @@ -222,8 +221,7 @@ public class DistCpUtils { final boolean preserveXAttrs = attributes.contains(FileAttribute.XATTR); if (preserveXAttrs || preserveRawXattrs) { - final String rawNS = - XAttr.NameSpace.RAW.name().toLowerCase(Locale.ENGLISH); + final String rawNS = XAttr.NameSpace.RAW.name().toLowerCase(); Map srcXAttrs = srcFileStatus.getXAttrs(); Map targetXAttrs = getXAttrs(targetFS, path); if (srcXAttrs != null && !srcXAttrs.equals(targetXAttrs)) { @@ -323,8 +321,7 @@ public class DistCpUtils { copyListingFileStatus.setXAttrs(srcXAttrs); } else { Map trgXAttrs = Maps.newHashMap(); - final String rawNS = - XAttr.NameSpace.RAW.name().toLowerCase(Locale.ENGLISH); + final String rawNS = XAttr.NameSpace.RAW.name().toLowerCase(); for (Map.Entry ent : srcXAttrs.entrySet()) { final String xattrName = ent.getKey(); if (xattrName.startsWith(rawNS)) { diff --git a/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCpV1.java b/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCpV1.java index 1db17f76b78..f46c421607a 100644 --- a/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCpV1.java +++ b/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCpV1.java @@ -31,7 +31,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Random; import java.util.Stack; import java.util.StringTokenizer; @@ -170,9 +169,7 @@ public class DistCpV1 implements Tool { final char symbol; - private FileAttribute() { - symbol = toString().toLowerCase(Locale.ENGLISH).charAt(0); - } + private FileAttribute() {symbol = toString().toLowerCase().charAt(0);} static EnumSet parse(String s) { if (s == null || s.length() == 0) { diff --git a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GridmixJobSubmissionPolicy.java b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GridmixJobSubmissionPolicy.java index b0107254205..83eb947c896 100644 --- a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GridmixJobSubmissionPolicy.java +++ b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GridmixJobSubmissionPolicy.java @@ -24,7 +24,6 @@ import org.apache.hadoop.mapred.gridmix.Statistics.JobStats; import org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats; import java.util.concurrent.CountDownLatch; -import java.util.Locale; import java.io.IOException; enum GridmixJobSubmissionPolicy { @@ -85,6 +84,6 @@ enum GridmixJobSubmissionPolicy { public static GridmixJobSubmissionPolicy getPolicy( Configuration conf, GridmixJobSubmissionPolicy defaultPolicy) { String policy = conf.get(JOB_SUBMISSION_POLICY, defaultPolicy.name()); - return valueOf(policy.toUpperCase(Locale.ENGLISH)); + return valueOf(policy.toUpperCase()); } } diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/HadoopLogsAnalyzer.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/HadoopLogsAnalyzer.java index 776391d03b7..47fdb1ad55b 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/HadoopLogsAnalyzer.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/HadoopLogsAnalyzer.java @@ -28,7 +28,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; import java.util.ArrayList; @@ -320,43 +319,42 @@ public class HadoopLogsAnalyzer extends Configured implements Tool { } for (int i = 0; i < args.length - (inputFilename == null ? 0 : 1); ++i) { - if ("-h".equals(args[i].toLowerCase(Locale.ENGLISH)) - || "-help".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-h".equals(args[i].toLowerCase()) + || "-help".equals(args[i].toLowerCase())) { usage(); return 0; } - if ("-c".equals(args[i].toLowerCase(Locale.ENGLISH)) - || "-collect-prefixes".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-c".equals(args[i].toLowerCase()) + || "-collect-prefixes".equals(args[i].toLowerCase())) { collecting = true; continue; } // these control the job digest - if ("-write-job-trace".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-write-job-trace".equals(args[i].toLowerCase())) { ++i; jobTraceFilename = new Path(args[i]); continue; } - if ("-single-line-job-traces".equals( - args[i].toLowerCase(Locale.ENGLISH))) { + if ("-single-line-job-traces".equals(args[i].toLowerCase())) { prettyprintTrace = false; continue; } - if ("-omit-task-details".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-omit-task-details".equals(args[i].toLowerCase())) { omitTaskDetails = true; continue; } - if ("-write-topology".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-write-topology".equals(args[i].toLowerCase())) { ++i; topologyFilename = new Path(args[i]); continue; } - if ("-job-digest-spectra".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-job-digest-spectra".equals(args[i].toLowerCase())) { ArrayList values = new ArrayList(); ++i; @@ -386,13 +384,13 @@ public class HadoopLogsAnalyzer extends Configured implements Tool { continue; } - if ("-d".equals(args[i].toLowerCase(Locale.ENGLISH)) - || "-debug".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-d".equals(args[i].toLowerCase()) + || "-debug".equals(args[i].toLowerCase())) { debug = true; continue; } - if ("-spreads".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-spreads".equals(args[i].toLowerCase())) { int min = Integer.parseInt(args[i + 1]); int max = Integer.parseInt(args[i + 2]); @@ -406,22 +404,22 @@ public class HadoopLogsAnalyzer extends Configured implements Tool { } // These control log-wide CDF outputs - if ("-delays".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-delays".equals(args[i].toLowerCase())) { delays = true; continue; } - if ("-runtimes".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-runtimes".equals(args[i].toLowerCase())) { runtimes = true; continue; } - if ("-tasktimes".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-tasktimes".equals(args[i].toLowerCase())) { collectTaskTimes = true; continue; } - if ("-v1".equals(args[i].toLowerCase(Locale.ENGLISH))) { + if ("-v1".equals(args[i].toLowerCase())) { version = 1; continue; } diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/JobBuilder.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/JobBuilder.java index 4b512d27f61..eaa9547a966 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/JobBuilder.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/JobBuilder.java @@ -20,7 +20,6 @@ package org.apache.hadoop.tools.rumen; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; @@ -434,7 +433,7 @@ public class JobBuilder { return Values.SUCCESS; } - return Values.valueOf(name.toUpperCase(Locale.ENGLISH)); + return Values.valueOf(name.toUpperCase()); } private void processTaskUpdatedEvent(TaskUpdatedEvent event) { diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTask.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTask.java index 068ac5bb7f5..903d5fbcfbc 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTask.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTask.java @@ -20,7 +20,6 @@ package org.apache.hadoop.tools.rumen; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.TreeSet; @@ -244,7 +243,7 @@ public class LoggedTask implements DeepCompare { } private static String canonicalizeCounterName(String nonCanonicalName) { - String result = nonCanonicalName.toLowerCase(Locale.ENGLISH); + String result = nonCanonicalName.toLowerCase(); result = result.replace(' ', '|'); result = result.replace('-', '|'); diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java index c7823c42872..d1b365eb33c 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java @@ -20,7 +20,6 @@ package org.apache.hadoop.tools.rumen; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.TreeSet; @@ -612,7 +611,7 @@ public class LoggedTaskAttempt implements DeepCompare { } private static String canonicalizeCounterName(String nonCanonicalName) { - String result = nonCanonicalName.toLowerCase(Locale.ENGLISH); + String result = nonCanonicalName.toLowerCase(); result = result.replace(' ', '|'); result = result.replace('-', '|'); diff --git a/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java b/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java index 72ff3b01f7d..98d8aa03064 100644 --- a/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java +++ b/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java @@ -43,7 +43,7 @@ public class Environment extends Properties { // http://lopica.sourceforge.net/os.html String command = null; String OS = System.getProperty("os.name"); - String lowerOs = OS.toLowerCase(Locale.ENGLISH); + String lowerOs = OS.toLowerCase(); if (OS.indexOf("Windows") > -1) { command = "cmd /C set"; } else if (lowerOs.indexOf("ix") > -1 || lowerOs.indexOf("linux") > -1 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java index 1cb3e5884e1..de8f7402534 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java @@ -26,7 +26,6 @@ import java.text.DecimalFormat; import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import org.apache.commons.cli.CommandLine; @@ -174,7 +173,7 @@ public class ApplicationCLI extends YarnCLI { if (types != null) { for (String type : types) { if (!type.trim().isEmpty()) { - appTypes.add(type.toUpperCase(Locale.ENGLISH).trim()); + appTypes.add(type.toUpperCase().trim()); } } } @@ -193,7 +192,7 @@ public class ApplicationCLI extends YarnCLI { } try { appStates.add(YarnApplicationState.valueOf(state - .toUpperCase(Locale.ENGLISH).trim())); + .toUpperCase().trim())); } catch (IllegalArgumentException ex) { sysout.println("The application state " + state + " is invalid."); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java index ce1c0fd9e1a..d6036262b0c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java @@ -27,7 +27,6 @@ import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import org.apache.commons.cli.CommandLine; @@ -112,8 +111,7 @@ public class NodeCLI extends YarnCLI { if (types != null) { for (String type : types) { if (!type.trim().isEmpty()) { - nodeStates.add( - NodeState.valueOf(type.trim().toUpperCase(Locale.ENGLISH))); + nodeStates.add(NodeState.valueOf(type.trim().toUpperCase())); } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java index 0b39dfe7e74..a8996f0298a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java @@ -21,7 +21,6 @@ package org.apache.hadoop.yarn.api.protocolrecords.impl.pb; import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import org.apache.commons.lang.math.LongRange; @@ -214,7 +213,7 @@ public class GetApplicationsRequestPBImpl extends GetApplicationsRequest { // Convert applicationTags to lower case and add this.applicationTags = new HashSet(); for (String tag : tags) { - this.applicationTags.add(tag.toLowerCase(Locale.ENGLISH)); + this.applicationTags.add(tag.toLowerCase()); } } @@ -259,8 +258,7 @@ public class GetApplicationsRequestPBImpl extends GetApplicationsRequest { public void setApplicationStates(Set applicationStates) { EnumSet appStates = null; for (YarnApplicationState state : YarnApplicationState.values()) { - if (applicationStates.contains( - state.name().toLowerCase(Locale.ENGLISH))) { + if (applicationStates.contains(state.name().toLowerCase())) { if (appStates == null) { appStates = EnumSet.of(state); } else { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java index fe89f81a492..303b4371601 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java @@ -19,7 +19,6 @@ package org.apache.hadoop.yarn.api.records.impl.pb; import java.util.HashSet; -import java.util.Locale; import java.util.Set; import org.apache.hadoop.classification.InterfaceAudience.Private; @@ -292,7 +291,7 @@ extends ApplicationSubmissionContext { // Convert applicationTags to lower case and add this.applicationTags = new HashSet(); for (String tag : tags) { - this.applicationTags.add(tag.toLowerCase(Locale.ENGLISH)); + this.applicationTags.add(tag.toLowerCase()); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/HamletGen.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/HamletGen.java index 45d9b61cde3..c8488288455 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/HamletGen.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/HamletGen.java @@ -241,8 +241,7 @@ public class HamletGen { puts(indent, "\n", "private ", retName, " ", methodName, "_(T e, boolean inline) {\n", - " return new ", retName, "(\"", - retName.toLowerCase(Locale.ENGLISH), + " return new ", retName, "(\"", retName.toLowerCase(Locale.US), "\", e, opt(", !endTagOptional.contains(retName), ", inline, ", retName.equals("PRE"), ")); }"); } @@ -259,7 +258,7 @@ public class HamletGen { puts(0, ") {"); puts(indent, topMode ? "" : " closeAttrs();\n", - " return ", retName.toLowerCase(Locale.ENGLISH), "_(this, ", + " return ", retName.toLowerCase(Locale.US), "_(this, ", isInline(className, retName), ");\n", "}"); } else if (params.length == 1) { puts(0, "String selector) {"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java index 4140df469ab..2040f575141 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java @@ -19,7 +19,6 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; import java.util.Collections; -import java.util.Locale; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -148,8 +147,7 @@ public class AHSWebServices extends WebServices { } Set appStates = parseQueries(statesQuery, true); for (String appState : appStates) { - switch (YarnApplicationState.valueOf( - appState.toUpperCase(Locale.ENGLISH))) { + switch (YarnApplicationState.valueOf(appState.toUpperCase())) { case FINISHED: case FAILED: case KILLED: diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java index 44ba2b9f0ae..0907f2c1541 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java @@ -24,7 +24,6 @@ import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -418,7 +417,7 @@ public class TimelineWebServices { String[] strs = str.split(delimiter); List fieldList = new ArrayList(); for (String s : strs) { - s = s.trim().toUpperCase(Locale.ENGLISH); + s = s.trim().toUpperCase(); if (s.equals("EVENTS")) { fieldList.add(Field.EVENTS); } else if (s.equals("LASTEVENTONLY")) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java index cc9000f8d63..385d10ae8b0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java @@ -23,7 +23,6 @@ import java.security.PrivilegedExceptionAction; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; -import java.util.Locale; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -165,7 +164,7 @@ public class WebServices { if (checkAppStates && !appStates.contains(appReport.getYarnApplicationState().toString() - .toLowerCase(Locale.ENGLISH))) { + .toLowerCase())) { continue; } if (finalStatusQuery != null && !finalStatusQuery.isEmpty()) { @@ -187,7 +186,7 @@ public class WebServices { } if (checkAppTypes && !appTypes.contains(appReport.getApplicationType().trim() - .toLowerCase(Locale.ENGLISH))) { + .toLowerCase())) { continue; } @@ -369,8 +368,7 @@ public class WebServices { if (isState) { try { // enum string is in the uppercase - YarnApplicationState.valueOf( - paramStr.trim().toUpperCase(Locale.ENGLISH)); + YarnApplicationState.valueOf(paramStr.trim().toUpperCase()); } catch (RuntimeException e) { YarnApplicationState[] stateArray = YarnApplicationState.values(); @@ -380,7 +378,7 @@ public class WebServices { + allAppStates); } } - params.add(paramStr.trim().toLowerCase(Locale.ENGLISH)); + params.add(paramStr.trim().toLowerCase()); } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index 85417665be3..46b45f852a3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -29,7 +29,6 @@ import java.util.Collections; import java.util.EnumSet; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; @@ -757,7 +756,7 @@ public class ClientRMService extends AbstractService implements if (applicationTypes != null && !applicationTypes.isEmpty()) { String appTypeToMatch = caseSensitive ? application.getApplicationType() - : application.getApplicationType().toLowerCase(Locale.ENGLISH); + : application.getApplicationType().toLowerCase(); if (!applicationTypes.contains(appTypeToMatch)) { continue; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java index e95b72503e4..230f9a9a580 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java @@ -18,7 +18,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.resource; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Evolving; @@ -62,7 +61,7 @@ public class ResourceWeights { sb.append(", "); } ResourceType resourceType = ResourceType.values()[i]; - sb.append(resourceType.name().toLowerCase(Locale.ENGLISH)); + sb.append(resourceType.name().toLowerCase()); sb.append(String.format(" weight=%.1f", getWeight(resourceType))); } sb.append(">"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java index 5e6d3ebfb10..3528c2d6178 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java @@ -24,7 +24,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -395,8 +394,7 @@ public class CapacitySchedulerConfiguration extends ReservationSchedulerConfigur public QueueState getState(String queue) { String state = get(getQueuePrefix(queue) + STATE); return (state != null) ? - QueueState.valueOf(state.toUpperCase(Locale.ENGLISH)) : - QueueState.RUNNING; + QueueState.valueOf(state.toUpperCase()) : QueueState.RUNNING; } public void setAccessibleNodeLabels(String queue, Set labels) { @@ -492,7 +490,7 @@ public class CapacitySchedulerConfiguration extends ReservationSchedulerConfigur } private static String getAclKey(QueueACL acl) { - return "acl_" + acl.toString().toLowerCase(Locale.ENGLISH); + return "acl_" + acl.toString().toLowerCase(); } public AccessControlList getAcl(String queue, QueueACL acl) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairSchedulerConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairSchedulerConfiguration.java index 092209218dd..32ef906a571 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairSchedulerConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairSchedulerConfiguration.java @@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair; import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -242,7 +241,7 @@ public class FairSchedulerConfiguration extends Configuration { public static Resource parseResourceConfigValue(String val) throws AllocationConfigurationException { try { - val = val.toLowerCase(Locale.ENGLISH); + val = val.toLowerCase(); int memory = findResource(val, "mb"); int vcores = findResource(val, "vcores"); return BuilderUtils.newResource(memory, vcores); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java index 23e7b810a3f..cc28afc1e49 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair; -import java.util.Locale; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Evolving; import org.apache.hadoop.util.ReflectionUtils; @@ -73,7 +72,7 @@ public abstract class SchedulingPolicy { throws AllocationConfigurationException { @SuppressWarnings("rawtypes") Class clazz; - String text = policy.toLowerCase(Locale.ENGLISH); + String text = policy.toLowerCase(); if (text.equalsIgnoreCase(FairSharePolicy.NAME)) { clazz = FairSharePolicy.class; } else if (text.equalsIgnoreCase(FifoPolicy.NAME)) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java index 881ecb78342..f28a9a88bc3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java @@ -18,7 +18,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; -import java.util.Locale; import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_STATE; import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_LABEL; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; @@ -78,7 +77,7 @@ class NodesPage extends RmView { .th(".nodeManagerVersion", "Version")._()._().tbody(); NodeState stateFilter = null; if (type != null && !type.isEmpty()) { - stateFilter = NodeState.valueOf(type.toUpperCase(Locale.ENGLISH)); + stateFilter = NodeState.valueOf(type.toUpperCase()); } Collection rmNodes = this.rm.getRMContext().getRMNodes().values(); boolean isInactive = false; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java index fb400542e6c..1834b6a1a7d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java @@ -30,7 +30,6 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; @@ -258,8 +257,7 @@ public class RMWebServices { } else { acceptedStates = EnumSet.noneOf(NodeState.class); for (String stateStr : states.split(",")) { - acceptedStates.add(NodeState.valueOf( - stateStr.toUpperCase(Locale.ENGLISH))); + acceptedStates.add(NodeState.valueOf(stateStr.toUpperCase())); } } @@ -508,7 +506,7 @@ public class RMWebServices { // if no states, returns the counts of all RMAppStates if (states.size() == 0) { for (YarnApplicationState state : YarnApplicationState.values()) { - states.add(state.toString().toLowerCase(Locale.ENGLISH)); + states.add(state.toString().toLowerCase()); } } // in case we extend to multiple applicationTypes in the future @@ -520,9 +518,8 @@ public class RMWebServices { ConcurrentMap apps = rm.getRMContext().getRMApps(); for (RMApp rmapp : apps.values()) { YarnApplicationState state = rmapp.createApplicationState(); - String type = - rmapp.getApplicationType().trim().toLowerCase(Locale.ENGLISH); - if (states.contains(state.toString().toLowerCase(Locale.ENGLISH))) { + String type = rmapp.getApplicationType().trim().toLowerCase(); + if (states.contains(state.toString().toLowerCase())) { if (types.contains(ANY)) { countApp(scoreboard, state, ANY); } else if (types.contains(type)) { @@ -557,8 +554,7 @@ public class RMWebServices { if (isState) { try { // enum string is in the uppercase - YarnApplicationState.valueOf( - paramStr.trim().toUpperCase(Locale.ENGLISH)); + YarnApplicationState.valueOf(paramStr.trim().toUpperCase()); } catch (RuntimeException e) { YarnApplicationState[] stateArray = YarnApplicationState.values(); @@ -568,7 +564,7 @@ public class RMWebServices { + " specified. It should be one of " + allAppStates); } } - params.add(paramStr.trim().toLowerCase(Locale.ENGLISH)); + params.add(paramStr.trim().toLowerCase()); } } } @@ -586,8 +582,7 @@ public class RMWebServices { for (String state : states) { Map partScoreboard = new HashMap(); scoreboard.put( - YarnApplicationState.valueOf( - state.toUpperCase(Locale.ENGLISH)), partScoreboard); + YarnApplicationState.valueOf(state.toUpperCase()), partScoreboard); // types is verified no to be empty for (String type : types) { partScoreboard.put(type, 0L);