HADOOP-11602. Fix toUpperCase/toLowerCase to use Locale.ENGLISH. (ozawa)
This commit is contained in:
parent
18fb421fab
commit
946456c6d8
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
class StabilityOptions {
|
class StabilityOptions {
|
||||||
public static final String STABLE_OPTION = "-stable";
|
public static final String STABLE_OPTION = "-stable";
|
||||||
@ -28,7 +29,7 @@ class StabilityOptions {
|
|||||||
public static final String UNSTABLE_OPTION = "-unstable";
|
public static final String UNSTABLE_OPTION = "-unstable";
|
||||||
|
|
||||||
public static Integer optionLength(String option) {
|
public static Integer optionLength(String option) {
|
||||||
String opt = option.toLowerCase();
|
String opt = option.toLowerCase(Locale.ENGLISH);
|
||||||
if (opt.equals(UNSTABLE_OPTION)) return 1;
|
if (opt.equals(UNSTABLE_OPTION)) return 1;
|
||||||
if (opt.equals(EVOLVING_OPTION)) return 1;
|
if (opt.equals(EVOLVING_OPTION)) return 1;
|
||||||
if (opt.equals(STABLE_OPTION)) return 1;
|
if (opt.equals(STABLE_OPTION)) return 1;
|
||||||
@ -38,7 +39,7 @@ public static Integer optionLength(String option) {
|
|||||||
public static void validOptions(String[][] options,
|
public static void validOptions(String[][] options,
|
||||||
DocErrorReporter reporter) {
|
DocErrorReporter reporter) {
|
||||||
for (int i = 0; i < options.length; i++) {
|
for (int i = 0; i < options.length; i++) {
|
||||||
String opt = options[i][0].toLowerCase();
|
String opt = options[i][0].toLowerCase(Locale.ENGLISH);
|
||||||
if (opt.equals(UNSTABLE_OPTION)) {
|
if (opt.equals(UNSTABLE_OPTION)) {
|
||||||
RootDocProcessor.stability = UNSTABLE_OPTION;
|
RootDocProcessor.stability = UNSTABLE_OPTION;
|
||||||
} else if (opt.equals(EVOLVING_OPTION)) {
|
} else if (opt.equals(EVOLVING_OPTION)) {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
package org.apache.hadoop.security.authentication.server;
|
package org.apache.hadoop.security.authentication.server;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -68,7 +69,8 @@ public void init(Properties config) throws ServletException {
|
|||||||
NON_BROWSER_USER_AGENTS, NON_BROWSER_USER_AGENTS_DEFAULT)
|
NON_BROWSER_USER_AGENTS, NON_BROWSER_USER_AGENTS_DEFAULT)
|
||||||
.split("\\W*,\\W*");
|
.split("\\W*,\\W*");
|
||||||
for (int i = 0; i < nonBrowserUserAgents.length; i++) {
|
for (int i = 0; i < nonBrowserUserAgents.length; i++) {
|
||||||
nonBrowserUserAgents[i] = nonBrowserUserAgents[i].toLowerCase();
|
nonBrowserUserAgents[i] =
|
||||||
|
nonBrowserUserAgents[i].toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +122,7 @@ protected boolean isBrowser(String userAgent) {
|
|||||||
if (userAgent == null) {
|
if (userAgent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
userAgent = userAgent.toLowerCase();
|
userAgent = userAgent.toLowerCase(Locale.ENGLISH);
|
||||||
boolean isBrowser = true;
|
boolean isBrowser = true;
|
||||||
for (String nonBrowserUserAgent : nonBrowserUserAgents) {
|
for (String nonBrowserUserAgent : nonBrowserUserAgents) {
|
||||||
if (userAgent.contains(nonBrowserUserAgent)) {
|
if (userAgent.contains(nonBrowserUserAgent)) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.directory.server.kerberos.shared.keytab.Keytab;
|
import org.apache.directory.server.kerberos.shared.keytab.Keytab;
|
||||||
@ -58,24 +59,25 @@ public void testGetServerPrincipal() throws IOException {
|
|||||||
|
|
||||||
// send null hostname
|
// send null hostname
|
||||||
Assert.assertEquals("When no hostname is sent",
|
Assert.assertEquals("When no hostname is sent",
|
||||||
service + "/" + localHostname.toLowerCase(),
|
service + "/" + localHostname.toLowerCase(Locale.ENGLISH),
|
||||||
KerberosUtil.getServicePrincipal(service, null));
|
KerberosUtil.getServicePrincipal(service, null));
|
||||||
// send empty hostname
|
// send empty hostname
|
||||||
Assert.assertEquals("When empty hostname is sent",
|
Assert.assertEquals("When empty hostname is sent",
|
||||||
service + "/" + localHostname.toLowerCase(),
|
service + "/" + localHostname.toLowerCase(Locale.ENGLISH),
|
||||||
KerberosUtil.getServicePrincipal(service, ""));
|
KerberosUtil.getServicePrincipal(service, ""));
|
||||||
// send 0.0.0.0 hostname
|
// send 0.0.0.0 hostname
|
||||||
Assert.assertEquals("When 0.0.0.0 hostname is sent",
|
Assert.assertEquals("When 0.0.0.0 hostname is sent",
|
||||||
service + "/" + localHostname.toLowerCase(),
|
service + "/" + localHostname.toLowerCase(Locale.ENGLISH),
|
||||||
KerberosUtil.getServicePrincipal(service, "0.0.0.0"));
|
KerberosUtil.getServicePrincipal(service, "0.0.0.0"));
|
||||||
// send uppercase hostname
|
// send uppercase hostname
|
||||||
Assert.assertEquals("When uppercase hostname is sent",
|
Assert.assertEquals("When uppercase hostname is sent",
|
||||||
service + "/" + testHost.toLowerCase(),
|
service + "/" + testHost.toLowerCase(Locale.ENGLISH),
|
||||||
KerberosUtil.getServicePrincipal(service, testHost));
|
KerberosUtil.getServicePrincipal(service, testHost));
|
||||||
// send lowercase hostname
|
// send lowercase hostname
|
||||||
Assert.assertEquals("When lowercase hostname is sent",
|
Assert.assertEquals("When lowercase hostname is sent",
|
||||||
service + "/" + testHost.toLowerCase(),
|
service + "/" + testHost.toLowerCase(Locale.ENGLISH),
|
||||||
KerberosUtil.getServicePrincipal(service, testHost.toLowerCase()));
|
KerberosUtil.getServicePrincipal(
|
||||||
|
service, testHost.toLowerCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -405,6 +405,8 @@ Trunk (Unreleased)
|
|||||||
|
|
||||||
HADOOP-11585. Fix formatting in Tracing.md (Masatake Iwasaki via aw)
|
HADOOP-11585. Fix formatting in Tracing.md (Masatake Iwasaki via aw)
|
||||||
|
|
||||||
|
HADOOP-11602. Fix toUpperCase/toLowerCase to use Locale.ENGLISH. (ozawa)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -1451,7 +1452,7 @@ public boolean getBoolean(String name, boolean defaultValue) {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
valueString = valueString.toLowerCase();
|
valueString = valueString.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
if ("true".equals(valueString))
|
if ("true".equals(valueString))
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.crypto;
|
package org.apache.hadoop.crypto;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +98,7 @@ public String getConfigSuffix() {
|
|||||||
String[] parts = name.split("/");
|
String[] parts = name.split("/");
|
||||||
StringBuilder suffix = new StringBuilder();
|
StringBuilder suffix = new StringBuilder();
|
||||||
for (String part : parts) {
|
for (String part : parts) {
|
||||||
suffix.append(".").append(part.toLowerCase());
|
suffix.append(".").append(part.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
return suffix.toString();
|
return suffix.toString();
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReadWriteLock;
|
import java.util.concurrent.locks.ReadWriteLock;
|
||||||
@ -422,7 +423,7 @@ public Metadata getMetadata(String name) throws IOException {
|
|||||||
@Override
|
@Override
|
||||||
public KeyVersion createKey(String name, byte[] material,
|
public KeyVersion createKey(String name, byte[] material,
|
||||||
Options options) throws IOException {
|
Options options) throws IOException {
|
||||||
Preconditions.checkArgument(name.equals(name.toLowerCase()),
|
Preconditions.checkArgument(name.equals(name.toLowerCase(Locale.ENGLISH)),
|
||||||
"Uppercase key names are unsupported: %s", name);
|
"Uppercase key names are unsupported: %s", name);
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
@ -2795,8 +2796,10 @@ static class Key {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Key(URI uri, Configuration conf, long unique) throws IOException {
|
Key(URI uri, Configuration conf, long unique) throws IOException {
|
||||||
scheme = uri.getScheme()==null?"":uri.getScheme().toLowerCase();
|
scheme = uri.getScheme() == null ?
|
||||||
authority = uri.getAuthority()==null?"":uri.getAuthority().toLowerCase();
|
"" : uri.getScheme().toLowerCase(Locale.ENGLISH);
|
||||||
|
authority = uri.getAuthority() == null ?
|
||||||
|
"" : uri.getAuthority().toLowerCase(Locale.ENGLISH);
|
||||||
this.unique = unique;
|
this.unique = unique;
|
||||||
|
|
||||||
this.ugi = UserGroupInformation.getCurrentUser();
|
this.ugi = UserGroupInformation.getCurrentUser();
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ public String toString() {
|
|||||||
sb.append("default:");
|
sb.append("default:");
|
||||||
}
|
}
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
sb.append(type.toString().toLowerCase());
|
sb.append(type.toString().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@ -263,7 +264,8 @@ public static AclEntry parseAclEntry(String aclStr,
|
|||||||
|
|
||||||
AclEntryType aclType = null;
|
AclEntryType aclType = null;
|
||||||
try {
|
try {
|
||||||
aclType = Enum.valueOf(AclEntryType.class, split[index].toUpperCase());
|
aclType = Enum.valueOf(
|
||||||
|
AclEntryType.class, split[index].toUpperCase(Locale.ENGLISH));
|
||||||
builder.setType(aclType);
|
builder.setType(aclType);
|
||||||
index++;
|
index++;
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.fs.GlobPattern;
|
import org.apache.hadoop.fs.GlobPattern;
|
||||||
import org.apache.hadoop.fs.shell.PathData;
|
import org.apache.hadoop.fs.shell.PathData;
|
||||||
@ -73,7 +74,7 @@ public void addArguments(Deque<String> args) {
|
|||||||
public void prepare() throws IOException {
|
public void prepare() throws IOException {
|
||||||
String argPattern = getArgument(1);
|
String argPattern = getArgument(1);
|
||||||
if (!caseSensitive) {
|
if (!caseSensitive) {
|
||||||
argPattern = argPattern.toLowerCase();
|
argPattern = argPattern.toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
globPattern = new GlobPattern(argPattern);
|
globPattern = new GlobPattern(argPattern);
|
||||||
}
|
}
|
||||||
@ -82,7 +83,7 @@ public void prepare() throws IOException {
|
|||||||
public Result apply(PathData item, int depth) throws IOException {
|
public Result apply(PathData item, int depth) throws IOException {
|
||||||
String name = getPath(item).getName();
|
String name = getPath(item).getName();
|
||||||
if (!caseSensitive) {
|
if (!caseSensitive) {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
if (globPattern.matches(name)) {
|
if (globPattern.matches(name)) {
|
||||||
return Result.PASS;
|
return Result.PASS;
|
||||||
|
@ -65,10 +65,10 @@ private void addCodec(CompressionCodec codec) {
|
|||||||
codecsByClassName.put(codec.getClass().getCanonicalName(), codec);
|
codecsByClassName.put(codec.getClass().getCanonicalName(), codec);
|
||||||
|
|
||||||
String codecName = codec.getClass().getSimpleName();
|
String codecName = codec.getClass().getSimpleName();
|
||||||
codecsByName.put(codecName.toLowerCase(), codec);
|
codecsByName.put(codecName.toLowerCase(Locale.ENGLISH), codec);
|
||||||
if (codecName.endsWith("Codec")) {
|
if (codecName.endsWith("Codec")) {
|
||||||
codecName = codecName.substring(0, codecName.length() - "Codec".length());
|
codecName = codecName.substring(0, codecName.length() - "Codec".length());
|
||||||
codecsByName.put(codecName.toLowerCase(), codec);
|
codecsByName.put(codecName.toLowerCase(Locale.ENGLISH), codec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ public CompressionCodec getCodecByName(String codecName) {
|
|||||||
CompressionCodec codec = getCodecByClassName(codecName);
|
CompressionCodec codec = getCodecByClassName(codecName);
|
||||||
if (codec == null) {
|
if (codec == null) {
|
||||||
// trying to get the codec by name in case the name was specified instead a class
|
// trying to get the codec by name in case the name was specified instead a class
|
||||||
codec = codecsByName.get(codecName.toLowerCase());
|
codec = codecsByName.get(codecName.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
return codec;
|
return codec;
|
||||||
}
|
}
|
||||||
|
@ -85,11 +85,12 @@ class MetricsConfig extends SubsetConfiguration {
|
|||||||
private ClassLoader pluginLoader;
|
private ClassLoader pluginLoader;
|
||||||
|
|
||||||
MetricsConfig(Configuration c, String prefix) {
|
MetricsConfig(Configuration c, String prefix) {
|
||||||
super(c, prefix.toLowerCase(Locale.US), ".");
|
super(c, prefix.toLowerCase(Locale.ENGLISH), ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetricsConfig create(String prefix) {
|
static MetricsConfig create(String prefix) {
|
||||||
return loadFirst(prefix, "hadoop-metrics2-"+ prefix.toLowerCase(Locale.US)
|
return loadFirst(prefix, "hadoop-metrics2" + "-"
|
||||||
|
+ prefix.toLowerCase(Locale.ENGLISH)
|
||||||
+".properties", DEFAULT_FILE_NAME);
|
+".properties", DEFAULT_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +617,6 @@ private InitMode initMode() {
|
|||||||
String m = System.getProperty(MS_INIT_MODE_KEY);
|
String m = System.getProperty(MS_INIT_MODE_KEY);
|
||||||
String m2 = m == null ? System.getenv(MS_INIT_MODE_KEY) : m;
|
String m2 = m == null ? System.getenv(MS_INIT_MODE_KEY) : m;
|
||||||
return InitMode.valueOf((m2 == null ? InitMode.NORMAL.name() : m2)
|
return InitMode.valueOf((m2 == null ? InitMode.NORMAL.name() : m2)
|
||||||
.toUpperCase(Locale.US));
|
.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,8 @@ private static String replacePattern(String[] components, String hostname)
|
|||||||
if (fqdn == null || fqdn.isEmpty() || fqdn.equals("0.0.0.0")) {
|
if (fqdn == null || fqdn.isEmpty() || fqdn.equals("0.0.0.0")) {
|
||||||
fqdn = getLocalHostName();
|
fqdn = getLocalHostName();
|
||||||
}
|
}
|
||||||
return components[0] + "/" + fqdn.toLowerCase(Locale.US) + "@" + components[2];
|
return components[0] + "/" + fqdn.toLowerCase(Locale.ENGLISH) + "@"
|
||||||
|
+ components[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getLocalHostName() throws UnknownHostException {
|
static String getLocalHostName() throws UnknownHostException {
|
||||||
@ -379,7 +380,7 @@ public static Text buildTokenService(InetSocketAddress addr) {
|
|||||||
}
|
}
|
||||||
host = addr.getAddress().getHostAddress();
|
host = addr.getAddress().getHostAddress();
|
||||||
} else {
|
} else {
|
||||||
host = addr.getHostName().toLowerCase();
|
host = addr.getHostName().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
return new Text(host + ":" + addr.getPort());
|
return new Text(host + ":" + addr.getPort());
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@ -138,7 +139,8 @@ static Map<String, String> getSaslProperties(Configuration conf) {
|
|||||||
QualityOfProtection.PRIVACY.toString());
|
QualityOfProtection.PRIVACY.toString());
|
||||||
|
|
||||||
for (int i=0; i < qop.length; i++) {
|
for (int i=0; i < qop.length; i++) {
|
||||||
qop[i] = QualityOfProtection.valueOf(qop[i].toUpperCase()).getSaslQop();
|
qop[i] = QualityOfProtection.valueOf(
|
||||||
|
qop[i].toUpperCase(Locale.ENGLISH)).getSaslQop();
|
||||||
}
|
}
|
||||||
|
|
||||||
saslProps.put(Sasl.QOP, StringUtils.join(",", qop));
|
saslProps.put(Sasl.QOP, StringUtils.join(",", qop));
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link KeyStoresFactory} implementation that reads the certificates from
|
* {@link KeyStoresFactory} implementation that reads the certificates from
|
||||||
@ -94,7 +95,8 @@ public class FileBasedKeyStoresFactory implements KeyStoresFactory {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static String resolvePropertyName(SSLFactory.Mode mode,
|
public static String resolvePropertyName(SSLFactory.Mode mode,
|
||||||
String template) {
|
String template) {
|
||||||
return MessageFormat.format(template, mode.toString().toLowerCase());
|
return MessageFormat.format(
|
||||||
|
template, mode.toString().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory that creates SSLEngine and SSLSocketFactory instances using
|
* Factory that creates SSLEngine and SSLSocketFactory instances using
|
||||||
@ -138,7 +139,7 @@ public void init() throws GeneralSecurityException, IOException {
|
|||||||
private HostnameVerifier getHostnameVerifier(Configuration conf)
|
private HostnameVerifier getHostnameVerifier(Configuration conf)
|
||||||
throws GeneralSecurityException, IOException {
|
throws GeneralSecurityException, IOException {
|
||||||
return getHostnameVerifier(conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT").
|
return getHostnameVerifier(conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT").
|
||||||
trim().toUpperCase());
|
trim().toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostnameVerifier getHostnameVerifier(String verifier)
|
public static HostnameVerifier getHostnameVerifier(String verifier)
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@ -365,7 +366,7 @@ public void check(final String[] hosts, final String[] cns,
|
|||||||
buf.append('<');
|
buf.append('<');
|
||||||
for (int i = 0; i < hosts.length; i++) {
|
for (int i = 0; i < hosts.length; i++) {
|
||||||
String h = hosts[i];
|
String h = hosts[i];
|
||||||
h = h != null ? h.trim().toLowerCase() : "";
|
h = h != null ? h.trim().toLowerCase(Locale.ENGLISH) : "";
|
||||||
hosts[i] = h;
|
hosts[i] = h;
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
buf.append('/');
|
buf.append('/');
|
||||||
@ -406,7 +407,7 @@ public void check(final String[] hosts, final String[] cns,
|
|||||||
out:
|
out:
|
||||||
for (Iterator<String> it = names.iterator(); it.hasNext();) {
|
for (Iterator<String> it = names.iterator(); it.hasNext();) {
|
||||||
// Don't trim the CN, though!
|
// Don't trim the CN, though!
|
||||||
final String cn = it.next().toLowerCase();
|
final String cn = it.next().toLowerCase(Locale.ENGLISH);
|
||||||
// Store CN in StringBuffer in case we need to report an error.
|
// Store CN in StringBuffer in case we need to report an error.
|
||||||
buf.append(" <");
|
buf.append(" <");
|
||||||
buf.append(cn);
|
buf.append(cn);
|
||||||
@ -424,7 +425,8 @@ public void check(final String[] hosts, final String[] cns,
|
|||||||
acceptableCountryWildcard(cn);
|
acceptableCountryWildcard(cn);
|
||||||
|
|
||||||
for (int i = 0; i < hosts.length; i++) {
|
for (int i = 0; i < hosts.length; i++) {
|
||||||
final String hostName = hosts[i].trim().toLowerCase();
|
final String hostName =
|
||||||
|
hosts[i].trim().toLowerCase(Locale.ENGLISH);
|
||||||
if (doWildcard) {
|
if (doWildcard) {
|
||||||
match = hostName.endsWith(cn.substring(1));
|
match = hostName.endsWith(cn.substring(1));
|
||||||
if (match && strictWithSubDomains) {
|
if (match && strictWithSubDomains) {
|
||||||
@ -479,7 +481,7 @@ public static boolean acceptableCountryWildcard(final String cn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocalhost(String host) {
|
public static boolean isLocalhost(String host) {
|
||||||
host = host != null ? host.trim().toLowerCase() : "";
|
host = host != null ? host.trim().toLowerCase(Locale.ENGLISH) : "";
|
||||||
if (host.startsWith("::1")) {
|
if (host.startsWith("::1")) {
|
||||||
int x = host.lastIndexOf('%');
|
int x = host.lastIndexOf('%');
|
||||||
if (x >= 0) {
|
if (x >= 0) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -169,7 +170,7 @@ public boolean managementOperation(AuthenticationToken token,
|
|||||||
boolean requestContinues = true;
|
boolean requestContinues = true;
|
||||||
String op = ServletUtils.getParameter(request,
|
String op = ServletUtils.getParameter(request,
|
||||||
KerberosDelegationTokenAuthenticator.OP_PARAM);
|
KerberosDelegationTokenAuthenticator.OP_PARAM);
|
||||||
op = (op != null) ? op.toUpperCase() : null;
|
op = (op != null) ? op.toUpperCase(Locale.ENGLISH) : null;
|
||||||
if (DELEGATION_TOKEN_OPS.contains(op) &&
|
if (DELEGATION_TOKEN_OPS.contains(op) &&
|
||||||
!request.getMethod().equals("OPTIONS")) {
|
!request.getMethod().equals("OPTIONS")) {
|
||||||
KerberosDelegationTokenAuthenticator.DelegationTokenOperation dtOp =
|
KerberosDelegationTokenAuthenticator.DelegationTokenOperation dtOp =
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,8 +287,8 @@ private Map doDelegationTokenOperation(URL url,
|
|||||||
HttpExceptionUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
|
HttpExceptionUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
|
||||||
if (hasResponse) {
|
if (hasResponse) {
|
||||||
String contentType = conn.getHeaderField(CONTENT_TYPE);
|
String contentType = conn.getHeaderField(CONTENT_TYPE);
|
||||||
contentType = (contentType != null) ? contentType.toLowerCase()
|
contentType = (contentType != null) ?
|
||||||
: null;
|
contentType.toLowerCase(Locale.ENGLISH) : null;
|
||||||
if (contentType != null &&
|
if (contentType != null &&
|
||||||
contentType.contains(APPLICATION_JSON_MIME)) {
|
contentType.contains(APPLICATION_JSON_MIME)) {
|
||||||
try {
|
try {
|
||||||
|
@ -901,7 +901,7 @@ public static String join(CharSequence separator, String[] strings) {
|
|||||||
*/
|
*/
|
||||||
public static String camelize(String s) {
|
public static String camelize(String s) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String[] words = split(s.toLowerCase(Locale.US), ESCAPE_CHAR, '_');
|
String[] words = split(s.toLowerCase(Locale.ENGLISH), ESCAPE_CHAR, '_');
|
||||||
|
|
||||||
for (String word : words)
|
for (String word : words)
|
||||||
sb.append(org.apache.commons.lang.StringUtils.capitalize(word));
|
sb.append(org.apache.commons.lang.StringUtils.capitalize(word));
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.BrokenBarrierException;
|
import java.util.concurrent.BrokenBarrierException;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@ -1296,7 +1297,7 @@ private static byte[] hexDumpToBytes(String hexdump) {
|
|||||||
|
|
||||||
StringBuilder hexString = new StringBuilder();
|
StringBuilder hexString = new StringBuilder();
|
||||||
|
|
||||||
for (String line : hexdump.toUpperCase().split("\n")) {
|
for (String line : hexdump.toUpperCase(Locale.ENGLISH).split("\n")) {
|
||||||
hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", ""));
|
hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", ""));
|
||||||
}
|
}
|
||||||
return StringUtils.hexStringToByte(hexString.toString());
|
return StringUtils.hexStringToByte(hexString.toString());
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -181,7 +182,7 @@ static String getQOPNames (QualityOfProtection[] qops){
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (QualityOfProtection qop:qops){
|
for (QualityOfProtection qop:qops){
|
||||||
sb.append(qop.name().toLowerCase());
|
sb.append(qop.name().toLowerCase(Locale.ENGLISH));
|
||||||
if (++i < qops.length){
|
if (++i < qops.length){
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
|
@ -103,13 +103,13 @@ public void testPrincipalsWithLowerCaseHosts() throws IOException {
|
|||||||
String realm = "@REALM";
|
String realm = "@REALM";
|
||||||
String principalInConf = service + SecurityUtil.HOSTNAME_PATTERN + realm;
|
String principalInConf = service + SecurityUtil.HOSTNAME_PATTERN + realm;
|
||||||
String hostname = "FooHost";
|
String hostname = "FooHost";
|
||||||
String principal = service + hostname.toLowerCase() + realm;
|
String principal = service + hostname.toLowerCase(Locale.ENGLISH) + realm;
|
||||||
verify(principalInConf, hostname, principal);
|
verify(principalInConf, hostname, principal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLocalHostNameForNullOrWild() throws Exception {
|
public void testLocalHostNameForNullOrWild() throws Exception {
|
||||||
String local = SecurityUtil.getLocalHostName().toLowerCase(Locale.US);
|
String local = SecurityUtil.getLocalHostName().toLowerCase(Locale.ENGLISH);
|
||||||
assertEquals("hdfs/" + local + "@REALM",
|
assertEquals("hdfs/" + local + "@REALM",
|
||||||
SecurityUtil.getServerPrincipal("hdfs/_HOST@REALM", (String)null));
|
SecurityUtil.getServerPrincipal("hdfs/_HOST@REALM", (String)null));
|
||||||
assertEquals("hdfs/" + local + "@REALM",
|
assertEquals("hdfs/" + local + "@REALM",
|
||||||
@ -260,7 +260,7 @@ void runBadPortPermutes(String arg, boolean validIfPosPort) {
|
|||||||
//LOG.info("address:"+addr+" host:"+host+" ip:"+ip+" port:"+port);
|
//LOG.info("address:"+addr+" host:"+host+" ip:"+ip+" port:"+port);
|
||||||
|
|
||||||
SecurityUtil.setTokenServiceUseIp(useIp);
|
SecurityUtil.setTokenServiceUseIp(useIp);
|
||||||
String serviceHost = useIp ? ip : host.toLowerCase();
|
String serviceHost = useIp ? ip : host.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
Token<?> token = new Token<TokenIdentifier>();
|
Token<?> token = new Token<TokenIdentifier>();
|
||||||
Text service = new Text(serviceHost+":"+port);
|
Text service = new Text(serviceHost+":"+port);
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.ConcurrentModificationException;
|
import java.util.ConcurrentModificationException;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS;
|
import static org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS;
|
||||||
@ -213,7 +214,7 @@ public void testGetServerSideGroups() throws IOException,
|
|||||||
userName = userName.substring(sp + 1);
|
userName = userName.substring(sp + 1);
|
||||||
}
|
}
|
||||||
// user names are case insensitive on Windows. Make consistent
|
// user names are case insensitive on Windows. Make consistent
|
||||||
userName = userName.toLowerCase();
|
userName = userName.toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
// get the groups
|
// get the groups
|
||||||
pp = Runtime.getRuntime().exec(Shell.WINDOWS ?
|
pp = Runtime.getRuntime().exec(Shell.WINDOWS ?
|
||||||
@ -233,7 +234,7 @@ public void testGetServerSideGroups() throws IOException,
|
|||||||
String loginUserName = login.getShortUserName();
|
String loginUserName = login.getShortUserName();
|
||||||
if(Shell.WINDOWS) {
|
if(Shell.WINDOWS) {
|
||||||
// user names are case insensitive on Windows. Make consistent
|
// user names are case insensitive on Windows. Make consistent
|
||||||
loginUserName = loginUserName.toLowerCase();
|
loginUserName = loginUserName.toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
assertEquals(userName, loginUserName);
|
assertEquals(userName, loginUserName);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.runner.notification.Failure;
|
import org.junit.runner.notification.Failure;
|
||||||
@ -93,7 +94,8 @@ static String buildThreadDump() {
|
|||||||
thread.getPriority(),
|
thread.getPriority(),
|
||||||
thread.getId(),
|
thread.getId(),
|
||||||
Thread.State.WAITING.equals(thread.getState()) ?
|
Thread.State.WAITING.equals(thread.getState()) ?
|
||||||
"in Object.wait()" : thread.getState().name().toLowerCase(),
|
"in Object.wait()" :
|
||||||
|
thread.getState().name().toLowerCase(Locale.ENGLISH),
|
||||||
Thread.State.WAITING.equals(thread.getState()) ?
|
Thread.State.WAITING.equals(thread.getState()) ?
|
||||||
"WAITING (on object monitor)" : thread.getState()));
|
"WAITING (on object monitor)" : thread.getState()));
|
||||||
for (StackTraceElement stackTraceElement : e.getValue()) {
|
for (StackTraceElement stackTraceElement : e.getValue()) {
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -382,8 +383,10 @@ private void chown(String userGroup, File file) throws IOException {
|
|||||||
private void assertOwners(File file, String expectedUser,
|
private void assertOwners(File file, String expectedUser,
|
||||||
String expectedGroup) throws IOException {
|
String expectedGroup) throws IOException {
|
||||||
String [] args = lsF(file).trim().split("[\\|]");
|
String [] args = lsF(file).trim().split("[\\|]");
|
||||||
assertEquals(expectedUser.toLowerCase(), args[2].toLowerCase());
|
assertEquals(expectedUser.toLowerCase(Locale.ENGLISH),
|
||||||
assertEquals(expectedGroup.toLowerCase(), args[3].toLowerCase());
|
args[2].toLowerCase(Locale.ENGLISH));
|
||||||
|
assertEquals(expectedGroup.toLowerCase(Locale.ENGLISH),
|
||||||
|
args[3].toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -359,10 +360,10 @@ private static Match getMatch(String line) {
|
|||||||
AccessPrivilege privilege = AccessPrivilege.READ_ONLY;
|
AccessPrivilege privilege = AccessPrivilege.READ_ONLY;
|
||||||
switch (parts.length) {
|
switch (parts.length) {
|
||||||
case 1:
|
case 1:
|
||||||
host = parts[0].toLowerCase().trim();
|
host = parts[0].toLowerCase(Locale.ENGLISH).trim();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
host = parts[0].toLowerCase().trim();
|
host = parts[0].toLowerCase(Locale.ENGLISH).trim();
|
||||||
String option = parts[1].trim();
|
String option = parts[1].trim();
|
||||||
if ("rw".equalsIgnoreCase(option)) {
|
if ("rw".equalsIgnoreCase(option)) {
|
||||||
privilege = AccessPrivilege.READ_WRITE;
|
privilege = AccessPrivilege.READ_WRITE;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +83,8 @@ public void doFilter(ServletRequest request, ServletResponse response,
|
|||||||
String method = httpReq.getMethod();
|
String method = httpReq.getMethod();
|
||||||
if (method.equals("PUT") || method.equals("POST")) {
|
if (method.equals("PUT") || method.equals("POST")) {
|
||||||
String op = httpReq.getParameter(HttpFSFileSystem.OP_PARAM);
|
String op = httpReq.getParameter(HttpFSFileSystem.OP_PARAM);
|
||||||
if (op != null && UPLOAD_OPERATIONS.contains(op.toUpperCase())) {
|
if (op != null &&
|
||||||
|
UPLOAD_OPERATIONS.contains(op.toUpperCase(Locale.ENGLISH))) {
|
||||||
if ("true".equalsIgnoreCase(httpReq.getParameter(HttpFSParametersProvider.DataParam.NAME))) {
|
if ("true".equalsIgnoreCase(httpReq.getParameter(HttpFSParametersProvider.DataParam.NAME))) {
|
||||||
String contentType = httpReq.getContentType();
|
String contentType = httpReq.getContentType();
|
||||||
contentTypeOK =
|
contentTypeOK =
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@ -527,7 +528,8 @@ public FSDelete(String path, boolean recursive) {
|
|||||||
@Override
|
@Override
|
||||||
public JSONObject execute(FileSystem fs) throws IOException {
|
public JSONObject execute(FileSystem fs) throws IOException {
|
||||||
boolean deleted = fs.delete(path, recursive);
|
boolean deleted = fs.delete(path, recursive);
|
||||||
return toJSON(HttpFSFileSystem.DELETE_JSON.toLowerCase(), deleted);
|
return toJSON(
|
||||||
|
HttpFSFileSystem.DELETE_JSON.toLowerCase(Locale.ENGLISH), deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -167,7 +168,8 @@ public static class OperationParam extends EnumParam<HttpFSFileSystem.Operation>
|
|||||||
*/
|
*/
|
||||||
public OperationParam(String operation) {
|
public OperationParam(String operation) {
|
||||||
super(NAME, HttpFSFileSystem.Operation.class,
|
super(NAME, HttpFSFileSystem.Operation.class,
|
||||||
HttpFSFileSystem.Operation.valueOf(operation.toUpperCase()));
|
HttpFSFileSystem.Operation.valueOf(
|
||||||
|
operation.toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ public Server(String name, String homeDir, Configuration config) {
|
|||||||
* @param config server configuration.
|
* @param config server configuration.
|
||||||
*/
|
*/
|
||||||
public Server(String name, String homeDir, String configDir, String logDir, String tempDir, Configuration config) {
|
public Server(String name, String homeDir, String configDir, String logDir, String tempDir, Configuration config) {
|
||||||
this.name = Check.notEmpty(name, "name").trim().toLowerCase();
|
this.name = Check.notEmpty(name, "name").trim().toLowerCase(Locale.ENGLISH);
|
||||||
this.homeDir = Check.notEmpty(homeDir, "homeDir");
|
this.homeDir = Check.notEmpty(homeDir, "homeDir");
|
||||||
this.configDir = Check.notEmpty(configDir, "configDir");
|
this.configDir = Check.notEmpty(configDir, "configDir");
|
||||||
this.logDir = Check.notEmpty(logDir, "logDir");
|
this.logDir = Check.notEmpty(logDir, "logDir");
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -254,7 +255,7 @@ public void run() {
|
|||||||
private Set<String> toLowerCase(Collection<String> collection) {
|
private Set<String> toLowerCase(Collection<String> collection) {
|
||||||
Set<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
for (String value : collection) {
|
for (String value : collection) {
|
||||||
set.add(value.toLowerCase());
|
set.add(value.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
@ -300,7 +301,7 @@ protected void closeFileSystem(FileSystem fs) throws IOException {
|
|||||||
|
|
||||||
protected void validateNamenode(String namenode) throws FileSystemAccessException {
|
protected void validateNamenode(String namenode) throws FileSystemAccessException {
|
||||||
if (nameNodeWhitelist.size() > 0 && !nameNodeWhitelist.contains("*")) {
|
if (nameNodeWhitelist.size() > 0 && !nameNodeWhitelist.contains("*")) {
|
||||||
if (!nameNodeWhitelist.contains(namenode.toLowerCase())) {
|
if (!nameNodeWhitelist.contains(namenode.toLowerCase(Locale.ENGLISH))) {
|
||||||
throw new FileSystemAccessException(FileSystemAccessException.ERROR.H05, namenode, "not in whitelist");
|
throw new FileSystemAccessException(FileSystemAccessException.ERROR.H05, namenode, "not in whitelist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.util.StringUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public abstract class EnumParam<E extends Enum<E>> extends Param<E> {
|
public abstract class EnumParam<E extends Enum<E>> extends Param<E> {
|
||||||
@ -34,7 +35,7 @@ public EnumParam(String name, Class<E> e, E defaultValue) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected E parse(String str) throws Exception {
|
protected E parse(String str) throws Exception {
|
||||||
return Enum.valueOf(klass, str.toUpperCase());
|
return Enum.valueOf(klass, str.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ protected EnumSet<E> parse(String str) throws Exception {
|
|||||||
final EnumSet<E> set = EnumSet.noneOf(klass);
|
final EnumSet<E> set = EnumSet.noneOf(klass);
|
||||||
if (!str.isEmpty()) {
|
if (!str.isEmpty()) {
|
||||||
for (String sub : str.split(",")) {
|
for (String sub : str.split(",")) {
|
||||||
set.add(Enum.valueOf(klass, sub.trim().toUpperCase()));
|
set.add(Enum.valueOf(klass, sub.trim().toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +71,7 @@ public Parameters getValue(HttpContext httpContext) {
|
|||||||
}
|
}
|
||||||
Enum op;
|
Enum op;
|
||||||
try {
|
try {
|
||||||
op = Enum.valueOf(enumClass, str.toUpperCase());
|
op = Enum.valueOf(enumClass, str.toUpperCase(Locale.ENGLISH));
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
MessageFormat.format("Invalid Operation [{0}]", str));
|
MessageFormat.format("Invalid Operation [{0}]", str));
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
@ -78,7 +79,7 @@ public static StorageType parseStorageType(int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static StorageType parseStorageType(String s) {
|
public static StorageType parseStorageType(String s) {
|
||||||
return StorageType.valueOf(s.toUpperCase());
|
return StorageType.valueOf(s.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<StorageType> getNonTransientTypes() {
|
private static List<StorageType> getNonTransientTypes() {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.hadoop.hdfs;
|
package org.apache.hadoop.hdfs;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.HadoopIllegalArgumentException;
|
import org.apache.hadoop.HadoopIllegalArgumentException;
|
||||||
@ -57,16 +58,22 @@ public static XAttr buildXAttr(String name, byte[] value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NameSpace ns;
|
NameSpace ns;
|
||||||
final String prefix = name.substring(0, prefixIndex).toLowerCase();
|
final String prefix = name.substring(0, prefixIndex)
|
||||||
if (prefix.equals(NameSpace.USER.toString().toLowerCase())) {
|
.toLowerCase(Locale.ENGLISH);
|
||||||
|
if (prefix.equals(
|
||||||
|
NameSpace.USER.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
ns = NameSpace.USER;
|
ns = NameSpace.USER;
|
||||||
} else if (prefix.equals(NameSpace.TRUSTED.toString().toLowerCase())) {
|
} else if (prefix.equals(
|
||||||
|
NameSpace.TRUSTED.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
ns = NameSpace.TRUSTED;
|
ns = NameSpace.TRUSTED;
|
||||||
} else if (prefix.equals(NameSpace.SYSTEM.toString().toLowerCase())) {
|
} else if (prefix.equals(
|
||||||
|
NameSpace.SYSTEM.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
ns = NameSpace.SYSTEM;
|
ns = NameSpace.SYSTEM;
|
||||||
} else if (prefix.equals(NameSpace.SECURITY.toString().toLowerCase())) {
|
} else if (prefix.equals(
|
||||||
|
NameSpace.SECURITY.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
ns = NameSpace.SECURITY;
|
ns = NameSpace.SECURITY;
|
||||||
} else if (prefix.equals(NameSpace.RAW.toString().toLowerCase())) {
|
} else if (prefix.equals(
|
||||||
|
NameSpace.RAW.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
ns = NameSpace.RAW;
|
ns = NameSpace.RAW;
|
||||||
} else {
|
} else {
|
||||||
throw new HadoopIllegalArgumentException("An XAttr name must be " +
|
throw new HadoopIllegalArgumentException("An XAttr name must be " +
|
||||||
@ -145,7 +152,7 @@ public static String getPrefixName(XAttr xAttr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String namespace = xAttr.getNameSpace().toString();
|
String namespace = xAttr.getNameSpace().toString();
|
||||||
return namespace.toLowerCase() + "." + xAttr.getName();
|
return namespace.toLowerCase(Locale.ENGLISH) + "." + xAttr.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.hadoop.hdfs.protocol;
|
package org.apache.hadoop.hdfs.protocol;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
@ -98,7 +99,7 @@ public static enum RollingUpgradeAction {
|
|||||||
|
|
||||||
/** Covert the given String to a RollingUpgradeAction. */
|
/** Covert the given String to a RollingUpgradeAction. */
|
||||||
public static RollingUpgradeAction fromString(String s) {
|
public static RollingUpgradeAction fromString(String s) {
|
||||||
return MAP.get(s.toUpperCase());
|
return MAP.get(s.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/** A collection of block storage policies. */
|
/** A collection of block storage policies. */
|
||||||
public class BlockStoragePolicySuite {
|
public class BlockStoragePolicySuite {
|
||||||
@ -131,7 +132,8 @@ public BlockStoragePolicy[] getAllPolicies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String buildXAttrName() {
|
public static String buildXAttrName() {
|
||||||
return XAttrNS.toString().toLowerCase() + "." + STORAGE_POLICY_XATTR_NAME;
|
return XAttrNS.toString().toLowerCase(Locale.ENGLISH) + "."
|
||||||
|
+ STORAGE_POLICY_XATTR_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XAttr buildXAttr(byte policyId) {
|
public static XAttr buildXAttr(byte policyId) {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ public static enum RollingUpgradeStartupOption{
|
|||||||
|
|
||||||
public String getOptionString() {
|
public String getOptionString() {
|
||||||
return StartupOption.ROLLINGUPGRADE.getName() + " "
|
return StartupOption.ROLLINGUPGRADE.getName() + " "
|
||||||
+ name().toLowerCase();
|
+ name().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(StartupOption option) {
|
public boolean matches(StartupOption option) {
|
||||||
@ -76,7 +77,7 @@ static RollingUpgradeStartupOption fromString(String s) {
|
|||||||
public static String getAllOptionString() {
|
public static String getAllOptionString() {
|
||||||
final StringBuilder b = new StringBuilder("<");
|
final StringBuilder b = new StringBuilder("<");
|
||||||
for(RollingUpgradeStartupOption opt : VALUES) {
|
for(RollingUpgradeStartupOption opt : VALUES) {
|
||||||
b.append(opt.name().toLowerCase()).append("|");
|
b.append(opt.name().toLowerCase(Locale.ENGLISH)).append("|");
|
||||||
}
|
}
|
||||||
b.setCharAt(b.length() - 1, '>');
|
b.setCharAt(b.length() - 1, '>');
|
||||||
return b.toString();
|
return b.toString();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.hdfs.server.datanode;
|
package org.apache.hadoop.hdfs.server.datanode;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -88,7 +89,8 @@ public static StorageLocation parse(String rawLocation)
|
|||||||
String classString = matcher.group(1);
|
String classString = matcher.group(1);
|
||||||
location = matcher.group(2);
|
location = matcher.group(2);
|
||||||
if (!classString.isEmpty()) {
|
if (!classString.isEmpty()) {
|
||||||
storageType = StorageType.valueOf(classString.toUpperCase());
|
storageType = StorageType.valueOf(
|
||||||
|
classString.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.CheckedInputStream;
|
import java.util.zip.CheckedInputStream;
|
||||||
import java.util.zip.Checksum;
|
import java.util.zip.Checksum;
|
||||||
@ -4348,7 +4349,7 @@ static class RollingUpgradeOp extends FSEditLogOp { // @Idempotent
|
|||||||
|
|
||||||
public RollingUpgradeOp(FSEditLogOpCodes code, String name) {
|
public RollingUpgradeOp(FSEditLogOpCodes code, String name) {
|
||||||
super(code);
|
super(code);
|
||||||
this.name = name.toUpperCase();
|
this.name = name.toUpperCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RollingUpgradeOp getStartInstance(OpInstanceCache cache) {
|
static RollingUpgradeOp getStartInstance(OpInstanceCache cache) {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import org.apache.hadoop.hdfs.StorageType;
|
import org.apache.hadoop.hdfs.StorageType;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class QuotaByStorageTypeEntry {
|
public class QuotaByStorageTypeEntry {
|
||||||
private StorageType type;
|
private StorageType type;
|
||||||
@ -53,7 +54,7 @@ public int hashCode() {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
assert (type != null);
|
assert (type != null);
|
||||||
sb.append(type.toString().toLowerCase());
|
sb.append(type.toString().toLowerCase(Locale.ENGLISH));
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
sb.append(quota);
|
sb.append(quota);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -587,7 +587,7 @@ private int processStartupCommand(CommandLineOpts opts) throws Exception {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String cmd = opts.getCommand().toString().toLowerCase();
|
String cmd = opts.getCommand().toString().toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
try {
|
try {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.HadoopIllegalArgumentException;
|
import org.apache.hadoop.HadoopIllegalArgumentException;
|
||||||
@ -79,19 +80,19 @@ enum Command {
|
|||||||
private static final Map<String, CommandHandler> map;
|
private static final Map<String, CommandHandler> map;
|
||||||
static {
|
static {
|
||||||
map = new HashMap<String, CommandHandler>();
|
map = new HashMap<String, CommandHandler>();
|
||||||
map.put(NAMENODE.getName().toLowerCase(),
|
map.put(NAMENODE.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new NameNodesCommandHandler());
|
new NameNodesCommandHandler());
|
||||||
map.put(SECONDARY.getName().toLowerCase(),
|
map.put(SECONDARY.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new SecondaryNameNodesCommandHandler());
|
new SecondaryNameNodesCommandHandler());
|
||||||
map.put(BACKUP.getName().toLowerCase(),
|
map.put(BACKUP.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new BackupNodesCommandHandler());
|
new BackupNodesCommandHandler());
|
||||||
map.put(INCLUDE_FILE.getName().toLowerCase(),
|
map.put(INCLUDE_FILE.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new CommandHandler(DFSConfigKeys.DFS_HOSTS));
|
new CommandHandler(DFSConfigKeys.DFS_HOSTS));
|
||||||
map.put(EXCLUDE_FILE.getName().toLowerCase(),
|
map.put(EXCLUDE_FILE.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new CommandHandler(DFSConfigKeys.DFS_HOSTS_EXCLUDE));
|
new CommandHandler(DFSConfigKeys.DFS_HOSTS_EXCLUDE));
|
||||||
map.put(NNRPCADDRESSES.getName().toLowerCase(),
|
map.put(NNRPCADDRESSES.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new NNRpcAddressesCommandHandler());
|
new NNRpcAddressesCommandHandler());
|
||||||
map.put(CONFKEY.getName().toLowerCase(),
|
map.put(CONFKEY.getName().toLowerCase(Locale.ENGLISH),
|
||||||
new PrintConfKeyCommandHandler());
|
new PrintConfKeyCommandHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ public String getDescription() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CommandHandler getHandler(String cmd) {
|
public static CommandHandler getHandler(String cmd) {
|
||||||
return map.get(cmd.toLowerCase());
|
return map.get(cmd.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
@ -43,7 +44,7 @@ public class OfflineEditsVisitorFactory {
|
|||||||
*/
|
*/
|
||||||
static public OfflineEditsVisitor getEditsVisitor(String filename,
|
static public OfflineEditsVisitor getEditsVisitor(String filename,
|
||||||
String processor, boolean printToScreen) throws IOException {
|
String processor, boolean printToScreen) throws IOException {
|
||||||
if(processor.toLowerCase().equals("binary")) {
|
if(processor.toLowerCase(Locale.ENGLISH).equals("binary")) {
|
||||||
return new BinaryEditsVisitor(filename);
|
return new BinaryEditsVisitor(filename);
|
||||||
}
|
}
|
||||||
OfflineEditsVisitor vis;
|
OfflineEditsVisitor vis;
|
||||||
@ -59,9 +60,9 @@ static public OfflineEditsVisitor getEditsVisitor(String filename,
|
|||||||
outs[1] = System.out;
|
outs[1] = System.out;
|
||||||
out = new TeeOutputStream(outs);
|
out = new TeeOutputStream(outs);
|
||||||
}
|
}
|
||||||
if(processor.toLowerCase().equals("xml")) {
|
if(processor.toLowerCase(Locale.ENGLISH).equals("xml")) {
|
||||||
vis = new XmlEditsVisitor(out);
|
vis = new XmlEditsVisitor(out);
|
||||||
} else if(processor.toLowerCase().equals("stats")) {
|
} else if(processor.toLowerCase(Locale.ENGLISH).equals("stats")) {
|
||||||
vis = new StatisticsEditsVisitor(out);
|
vis = new StatisticsEditsVisitor(out);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Unknown proccesor " + processor +
|
throw new IOException("Unknown proccesor " + processor +
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;
|
import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;
|
||||||
@ -141,7 +142,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
|
|||||||
private static String getOp(QueryStringDecoder decoder) {
|
private static String getOp(QueryStringDecoder decoder) {
|
||||||
Map<String, List<String>> parameters = decoder.parameters();
|
Map<String, List<String>> parameters = decoder.parameters();
|
||||||
return parameters.containsKey("op")
|
return parameters.containsKey("op")
|
||||||
? parameters.get("op").get(0).toUpperCase() : null;
|
? parameters.get("op").get(0).toUpperCase(Locale.ENGLISH) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getPath(QueryStringDecoder decoder)
|
private static String getPath(QueryStringDecoder decoder)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ private static HttpServletRequest toLowerCase(final HttpServletRequest request)
|
|||||||
|
|
||||||
final Map<String, List<String>> m = new HashMap<String, List<String>>();
|
final Map<String, List<String>> m = new HashMap<String, List<String>>();
|
||||||
for(Map.Entry<String, String[]> entry : original.entrySet()) {
|
for(Map.Entry<String, String[]> entry : original.entrySet()) {
|
||||||
final String key = entry.getKey().toLowerCase();
|
final String key = entry.getKey().toLowerCase(Locale.ENGLISH);
|
||||||
List<String> strings = m.get(key);
|
List<String> strings = m.get(key);
|
||||||
if (strings == null) {
|
if (strings == null) {
|
||||||
strings = new ArrayList<String>();
|
strings = new ArrayList<String>();
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
@ -75,7 +76,7 @@ private static URI rebuildQuery(final URI uri,
|
|||||||
final MultivaluedMap<String, String> parameters) {
|
final MultivaluedMap<String, String> parameters) {
|
||||||
UriBuilder b = UriBuilder.fromUri(uri).replaceQuery("");
|
UriBuilder b = UriBuilder.fromUri(uri).replaceQuery("");
|
||||||
for(Map.Entry<String, List<String>> e : parameters.entrySet()) {
|
for(Map.Entry<String, List<String>> e : parameters.entrySet()) {
|
||||||
final String key = e.getKey().toLowerCase();
|
final String key = e.getKey().toLowerCase(Locale.ENGLISH);
|
||||||
for(String v : e.getValue()) {
|
for(String v : e.getValue()) {
|
||||||
b = b.queryParam(key, v);
|
b = b.queryParam(key, v);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
@ -1242,7 +1243,7 @@ static URL removeOffsetParam(final URL url) throws MalformedURLException {
|
|||||||
if (query == null) {
|
if (query == null) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
final String lower = query.toLowerCase();
|
final String lower = query.toLowerCase(Locale.ENGLISH);
|
||||||
if (!lower.startsWith(OFFSET_PARAM_PREFIX)
|
if (!lower.startsWith(OFFSET_PARAM_PREFIX)
|
||||||
&& !lower.contains("&" + OFFSET_PARAM_PREFIX)) {
|
&& !lower.contains("&" + OFFSET_PARAM_PREFIX)) {
|
||||||
return url;
|
return url;
|
||||||
@ -1253,7 +1254,7 @@ static URL removeOffsetParam(final URL url) throws MalformedURLException {
|
|||||||
for(final StringTokenizer st = new StringTokenizer(query, "&");
|
for(final StringTokenizer st = new StringTokenizer(query, "&");
|
||||||
st.hasMoreTokens();) {
|
st.hasMoreTokens();) {
|
||||||
final String token = st.nextToken();
|
final String token = st.nextToken();
|
||||||
if (!token.toLowerCase().startsWith(OFFSET_PARAM_PREFIX)) {
|
if (!token.toLowerCase(Locale.ENGLISH).startsWith(OFFSET_PARAM_PREFIX)) {
|
||||||
if (b == null) {
|
if (b == null) {
|
||||||
b = new StringBuilder("?").append(token);
|
b = new StringBuilder("?").append(token);
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.hadoop.hdfs.web.resources;
|
package org.apache.hadoop.hdfs.web.resources;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
abstract class EnumParam<E extends Enum<E>> extends Param<E, EnumParam.Domain<E>> {
|
abstract class EnumParam<E extends Enum<E>> extends Param<E, EnumParam.Domain<E>> {
|
||||||
EnumParam(final Domain<E> domain, final E value) {
|
EnumParam(final Domain<E> domain, final E value) {
|
||||||
@ -40,7 +41,7 @@ public final String getDomain() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
final E parse(final String str) {
|
final E parse(final String str) {
|
||||||
return Enum.valueOf(enumClass, str.toUpperCase());
|
return Enum.valueOf(enumClass, str.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
abstract class EnumSetParam<E extends Enum<E>> extends Param<EnumSet<E>, EnumSetParam.Domain<E>> {
|
abstract class EnumSetParam<E extends Enum<E>> extends Param<EnumSet<E>, EnumSetParam.Domain<E>> {
|
||||||
/** Convert an EnumSet to a string of comma separated values. */
|
/** Convert an EnumSet to a string of comma separated values. */
|
||||||
@ -82,7 +83,8 @@ final EnumSet<E> parse(final String str) {
|
|||||||
i = j > 0 ? j + 1 : 0;
|
i = j > 0 ? j + 1 : 0;
|
||||||
j = str.indexOf(',', i);
|
j = str.indexOf(',', i);
|
||||||
final String sub = j >= 0? str.substring(i, j): str.substring(i);
|
final String sub = j >= 0? str.substring(i, j): str.substring(i);
|
||||||
set.add(Enum.valueOf(enumClass, sub.trim().toUpperCase()));
|
set.add(
|
||||||
|
Enum.valueOf(enumClass, sub.trim().toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.protocol.SnapshotException;
|
import org.apache.hadoop.hdfs.protocol.SnapshotException;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.FSDirectory;
|
import org.apache.hadoop.hdfs.server.namenode.FSDirectory;
|
||||||
@ -70,7 +71,7 @@ public void testSnapshotLimits() throws Exception {
|
|||||||
Assert.fail("Expected SnapshotException not thrown");
|
Assert.fail("Expected SnapshotException not thrown");
|
||||||
} catch (SnapshotException se) {
|
} catch (SnapshotException se) {
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
se.getMessage().toLowerCase().contains("rollover"));
|
se.getMessage().toLowerCase(Locale.ENGLISH).contains("rollover"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a snapshot to free up a slot.
|
// Delete a snapshot to free up a slot.
|
||||||
@ -86,7 +87,7 @@ public void testSnapshotLimits() throws Exception {
|
|||||||
Assert.fail("Expected SnapshotException not thrown");
|
Assert.fail("Expected SnapshotException not thrown");
|
||||||
} catch (SnapshotException se) {
|
} catch (SnapshotException se) {
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
se.getMessage().toLowerCase().contains("rollover"));
|
se.getMessage().toLowerCase(Locale.ENGLISH).contains("rollover"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
@ -711,7 +712,8 @@ public void processEventForJobSummary(HistoryEvent event, JobSummary summary,
|
|||||||
private void processEventForTimelineServer(HistoryEvent event, JobId jobId,
|
private void processEventForTimelineServer(HistoryEvent event, JobId jobId,
|
||||||
long timestamp) {
|
long timestamp) {
|
||||||
TimelineEvent tEvent = new TimelineEvent();
|
TimelineEvent tEvent = new TimelineEvent();
|
||||||
tEvent.setEventType(event.getEventType().name().toUpperCase());
|
tEvent.setEventType(
|
||||||
|
event.getEventType().name().toUpperCase(Locale.ENGLISH));
|
||||||
tEvent.setTimestamp(timestamp);
|
tEvent.setTimestamp(timestamp);
|
||||||
TimelineEntity tEntity = new TimelineEntity();
|
TimelineEntity tEntity = new TimelineEntity();
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public void tasks() {
|
|||||||
try {
|
try {
|
||||||
String tt = $(TASK_TYPE);
|
String tt = $(TASK_TYPE);
|
||||||
tt = tt.isEmpty() ? "All" : StringUtils.capitalize(MRApps.taskType(tt).
|
tt = tt.isEmpty() ? "All" : StringUtils.capitalize(MRApps.taskType(tt).
|
||||||
toString().toLowerCase(Locale.US));
|
toString().toLowerCase(Locale.ENGLISH));
|
||||||
setTitle(join(tt, " Tasks for ", $(JOB_ID)));
|
setTitle(join(tt, " Tasks for ", $(JOB_ID)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Failed to render tasks page with task type : "
|
LOG.error("Failed to render tasks page with task type : "
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.mapred.JobPriority;
|
import org.apache.hadoop.mapred.JobPriority;
|
||||||
@ -314,7 +315,7 @@ public static org.apache.hadoop.mapreduce.QueueState fromYarn(
|
|||||||
QueueState state) {
|
QueueState state) {
|
||||||
org.apache.hadoop.mapreduce.QueueState qState =
|
org.apache.hadoop.mapreduce.QueueState qState =
|
||||||
org.apache.hadoop.mapreduce.QueueState.getState(
|
org.apache.hadoop.mapreduce.QueueState.getState(
|
||||||
state.toString().toLowerCase());
|
state.toString().toLowerCase(Locale.ENGLISH));
|
||||||
return qState;
|
return qState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
@ -303,7 +304,7 @@ private static void addToClasspathIfNotJar(Path[] paths,
|
|||||||
remoteFS.getWorkingDirectory()));
|
remoteFS.getWorkingDirectory()));
|
||||||
String name = (null == u.getFragment())
|
String name = (null == u.getFragment())
|
||||||
? p.getName() : u.getFragment();
|
? p.getName() : u.getFragment();
|
||||||
if (!name.toLowerCase().endsWith(".jar")) {
|
if (!name.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
|
||||||
linkLookup.put(p, name);
|
linkLookup.put(p, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +318,7 @@ private static void addToClasspathIfNotJar(Path[] paths,
|
|||||||
if (name == null) {
|
if (name == null) {
|
||||||
name = p.getName();
|
name = p.getName();
|
||||||
}
|
}
|
||||||
if(!name.toLowerCase().endsWith(".jar")) {
|
if(!name.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
|
||||||
MRApps.addToEnvironment(
|
MRApps.addToEnvironment(
|
||||||
environment,
|
environment,
|
||||||
classpathEnvVar,
|
classpathEnvVar,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.mapreduce.JobStatus.State;
|
import org.apache.hadoop.mapreduce.JobStatus.State;
|
||||||
@ -153,7 +154,8 @@ public void testFromYarnQueueInfo() {
|
|||||||
org.apache.hadoop.mapreduce.QueueInfo returned =
|
org.apache.hadoop.mapreduce.QueueInfo returned =
|
||||||
TypeConverter.fromYarn(queueInfo, new Configuration());
|
TypeConverter.fromYarn(queueInfo, new Configuration());
|
||||||
Assert.assertEquals("queueInfo translation didn't work.",
|
Assert.assertEquals("queueInfo translation didn't work.",
|
||||||
returned.getState().toString(), queueInfo.getQueueState().toString().toLowerCase());
|
returned.getState().toString(),
|
||||||
|
queueInfo.getQueueState().toString().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@ -116,7 +117,7 @@ public static enum Counter {
|
|||||||
* BYTES_READ counter and second one is of the BYTES_WRITTEN counter.
|
* BYTES_READ counter and second one is of the BYTES_WRITTEN counter.
|
||||||
*/
|
*/
|
||||||
protected static String[] getFileSystemCounterNames(String uriScheme) {
|
protected static String[] getFileSystemCounterNames(String uriScheme) {
|
||||||
String scheme = uriScheme.toUpperCase();
|
String scheme = uriScheme.toUpperCase(Locale.ENGLISH);
|
||||||
return new String[]{scheme+"_BYTES_READ", scheme+"_BYTES_WRITTEN"};
|
return new String[]{scheme+"_BYTES_READ", scheme+"_BYTES_WRITTEN"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ else if (counters[ord] == null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String checkScheme(String scheme) {
|
private String checkScheme(String scheme) {
|
||||||
String fixed = scheme.toUpperCase(Locale.US);
|
String fixed = scheme.toUpperCase(Locale.ENGLISH);
|
||||||
String interned = schemes.putIfAbsent(fixed, fixed);
|
String interned = schemes.putIfAbsent(fixed, fixed);
|
||||||
if (schemes.size() > MAX_NUM_SCHEMES) {
|
if (schemes.size() > MAX_NUM_SCHEMES) {
|
||||||
// mistakes or abuses
|
// mistakes or abuses
|
||||||
|
@ -473,7 +473,7 @@ public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives) {
|
|||||||
if (fragment == null) {
|
if (fragment == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String lowerCaseFragment = fragment.toLowerCase();
|
String lowerCaseFragment = fragment.toLowerCase(Locale.ENGLISH);
|
||||||
if (fragments.contains(lowerCaseFragment)) {
|
if (fragments.contains(lowerCaseFragment)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -488,7 +488,7 @@ public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives) {
|
|||||||
if (fragment == null) {
|
if (fragment == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String lowerCaseFragment = fragment.toLowerCase();
|
String lowerCaseFragment = fragment.toLowerCase(Locale.ENGLISH);
|
||||||
if (fragments.contains(lowerCaseFragment)) {
|
if (fragments.contains(lowerCaseFragment)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -162,7 +163,8 @@ public void setConf(Configuration conf) {
|
|||||||
this.connection = createConnection();
|
this.connection = createConnection();
|
||||||
|
|
||||||
DatabaseMetaData dbMeta = connection.getMetaData();
|
DatabaseMetaData dbMeta = connection.getMetaData();
|
||||||
this.dbProductName = dbMeta.getDatabaseProductName().toUpperCase();
|
this.dbProductName =
|
||||||
|
dbMeta.getDatabaseProductName().toUpperCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -222,12 +223,12 @@ public int run(String[] argv) throws Exception {
|
|||||||
taskType = argv[2];
|
taskType = argv[2];
|
||||||
taskState = argv[3];
|
taskState = argv[3];
|
||||||
displayTasks = true;
|
displayTasks = true;
|
||||||
if (!taskTypes.contains(taskType.toUpperCase())) {
|
if (!taskTypes.contains(taskType.toUpperCase(Locale.ENGLISH))) {
|
||||||
System.out.println("Error: Invalid task-type: " + taskType);
|
System.out.println("Error: Invalid task-type: " + taskType);
|
||||||
displayUsage(cmd);
|
displayUsage(cmd);
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
if (!taskStates.contains(taskState.toLowerCase())) {
|
if (!taskStates.contains(taskState.toLowerCase(Locale.ENGLISH))) {
|
||||||
System.out.println("Error: Invalid task-state: " + taskState);
|
System.out.println("Error: Invalid task-state: " + taskState);
|
||||||
displayUsage(cmd);
|
displayUsage(cmd);
|
||||||
return exitCode;
|
return exitCode;
|
||||||
@ -593,7 +594,8 @@ protected void displayTasks(Job job, String type, String state)
|
|||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
|
|
||||||
TaskReport[] reports=null;
|
TaskReport[] reports=null;
|
||||||
reports = job.getTaskReports(TaskType.valueOf(type.toUpperCase()));
|
reports = job.getTaskReports(
|
||||||
|
TaskType.valueOf(type.toUpperCase(Locale.ENGLISH)));
|
||||||
for (TaskReport report : reports) {
|
for (TaskReport report : reports) {
|
||||||
TIPStatus status = report.getCurrentStatus();
|
TIPStatus status = report.getCurrentStatus();
|
||||||
if ((state.equalsIgnoreCase("pending") && status ==TIPStatus.PENDING) ||
|
if ((state.equalsIgnoreCase("pending") && status ==TIPStatus.PENDING) ||
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -154,16 +155,16 @@ long value() {
|
|||||||
static ByteMultiple parseString(String sMultiple) {
|
static ByteMultiple parseString(String sMultiple) {
|
||||||
if(sMultiple == null || sMultiple.isEmpty()) // MB by default
|
if(sMultiple == null || sMultiple.isEmpty()) // MB by default
|
||||||
return MB;
|
return MB;
|
||||||
String sMU = sMultiple.toUpperCase();
|
String sMU = sMultiple.toUpperCase(Locale.ENGLISH);
|
||||||
if(B.name().toUpperCase().endsWith(sMU))
|
if(B.name().toUpperCase(Locale.ENGLISH).endsWith(sMU))
|
||||||
return B;
|
return B;
|
||||||
if(KB.name().toUpperCase().endsWith(sMU))
|
if(KB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU))
|
||||||
return KB;
|
return KB;
|
||||||
if(MB.name().toUpperCase().endsWith(sMU))
|
if(MB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU))
|
||||||
return MB;
|
return MB;
|
||||||
if(GB.name().toUpperCase().endsWith(sMU))
|
if(GB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU))
|
||||||
return GB;
|
return GB;
|
||||||
if(TB.name().toUpperCase().endsWith(sMU))
|
if(TB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU))
|
||||||
return TB;
|
return TB;
|
||||||
throw new IllegalArgumentException("Unsupported ByteMultiple "+sMultiple);
|
throw new IllegalArgumentException("Unsupported ByteMultiple "+sMultiple);
|
||||||
}
|
}
|
||||||
@ -736,7 +737,7 @@ public int run(String[] args) throws IOException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < args.length; i++) { // parse command line
|
for (int i = 0; i < args.length; i++) { // parse command line
|
||||||
if (args[i].toLowerCase().startsWith("-read")) {
|
if (args[i].toLowerCase(Locale.ENGLISH).startsWith("-read")) {
|
||||||
testType = TestType.TEST_TYPE_READ;
|
testType = TestType.TEST_TYPE_READ;
|
||||||
} else if (args[i].equalsIgnoreCase("-write")) {
|
} else if (args[i].equalsIgnoreCase("-write")) {
|
||||||
testType = TestType.TEST_TYPE_WRITE;
|
testType = TestType.TEST_TYPE_WRITE;
|
||||||
@ -755,9 +756,10 @@ public int run(String[] args) throws IOException {
|
|||||||
testType = TestType.TEST_TYPE_TRUNCATE;
|
testType = TestType.TEST_TYPE_TRUNCATE;
|
||||||
} else if (args[i].equalsIgnoreCase("-clean")) {
|
} else if (args[i].equalsIgnoreCase("-clean")) {
|
||||||
testType = TestType.TEST_TYPE_CLEANUP;
|
testType = TestType.TEST_TYPE_CLEANUP;
|
||||||
} else if (args[i].toLowerCase().startsWith("-seq")) {
|
} else if (args[i].toLowerCase(Locale.ENGLISH).startsWith("-seq")) {
|
||||||
isSequential = true;
|
isSequential = true;
|
||||||
} else if (args[i].toLowerCase().startsWith("-compression")) {
|
} else if (
|
||||||
|
args[i].toLowerCase(Locale.ENGLISH).startsWith("-compression")) {
|
||||||
compressionClass = args[++i];
|
compressionClass = args[++i];
|
||||||
} else if (args[i].equalsIgnoreCase("-nrfiles")) {
|
} else if (args[i].equalsIgnoreCase("-nrfiles")) {
|
||||||
nrFiles = Integer.parseInt(args[++i]);
|
nrFiles = Integer.parseInt(args[++i]);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -556,7 +557,10 @@ static void runTestCache(int port) throws Exception {
|
|||||||
static void checkPath(MiniDFSCluster cluster, FileSystem fileSys) throws IOException {
|
static void checkPath(MiniDFSCluster cluster, FileSystem fileSys) throws IOException {
|
||||||
InetSocketAddress add = cluster.getNameNode().getNameNodeAddress();
|
InetSocketAddress add = cluster.getNameNode().getNameNodeAddress();
|
||||||
// Test upper/lower case
|
// Test upper/lower case
|
||||||
fileSys.checkPath(new Path("hdfs://" + add.getHostName().toUpperCase() + ":" + add.getPort()));
|
fileSys.checkPath(
|
||||||
|
new Path("hdfs://"
|
||||||
|
+ add.getHostName().toUpperCase(Locale.ENGLISH)
|
||||||
|
+ ":" + add.getPort()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFsClose() throws Exception {
|
public void testFsClose() throws Exception {
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.fs.slive;
|
package org.apache.hadoop.fs.slive;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants used in various places in slive
|
* Constants used in various places in slive
|
||||||
*/
|
*/
|
||||||
@ -35,7 +37,7 @@ private Constants() {
|
|||||||
enum Distribution {
|
enum Distribution {
|
||||||
BEG, END, UNIFORM, MID;
|
BEG, END, UNIFORM, MID;
|
||||||
String lowerName() {
|
String lowerName() {
|
||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +47,7 @@ String lowerName() {
|
|||||||
enum OperationType {
|
enum OperationType {
|
||||||
READ, APPEND, RENAME, LS, MKDIR, DELETE, CREATE;
|
READ, APPEND, RENAME, LS, MKDIR, DELETE, CREATE;
|
||||||
String lowerName() {
|
String lowerName() {
|
||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.fs.slive;
|
package org.apache.hadoop.fs.slive;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.apache.hadoop.fs.slive.Constants.Distribution;
|
import org.apache.hadoop.fs.slive.Constants.Distribution;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +53,8 @@ class OperationData {
|
|||||||
percent = (Double.parseDouble(pieces[0]) / 100.0d);
|
percent = (Double.parseDouble(pieces[0]) / 100.0d);
|
||||||
} else if (pieces.length >= 2) {
|
} else if (pieces.length >= 2) {
|
||||||
percent = (Double.parseDouble(pieces[0]) / 100.0d);
|
percent = (Double.parseDouble(pieces[0]) / 100.0d);
|
||||||
distribution = Distribution.valueOf(pieces[1].toUpperCase());
|
distribution =
|
||||||
|
Distribution.valueOf(pieces[1].toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.fs.slive;
|
package org.apache.hadoop.fs.slive;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.apache.hadoop.io.Text;
|
import org.apache.hadoop.io.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +68,8 @@ static enum OutputType {
|
|||||||
"Invalid key format - no type seperator - " + TYPE_SEP);
|
"Invalid key format - no type seperator - " + TYPE_SEP);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
dataType = OutputType.valueOf(key.substring(0, place).toUpperCase());
|
dataType = OutputType.valueOf(
|
||||||
|
key.substring(0, place).toUpperCase(Locale.ENGLISH));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Invalid key format - invalid output type", e);
|
"Invalid key format - invalid output type", e);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ private boolean getBool(String val) {
|
|||||||
if (val == null) {
|
if (val == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String cleanupOpt = val.toLowerCase().trim();
|
String cleanupOpt = val.toLowerCase(Locale.ENGLISH).trim();
|
||||||
if (cleanupOpt.equals("true") || cleanupOpt.equals("1")) {
|
if (cleanupOpt.equals("true") || cleanupOpt.equals("1")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -214,23 +215,25 @@ public int run(String[] argv) throws IOException {
|
|||||||
if (!(fmt == Format.txt || cod == CCodec.pln)) {
|
if (!(fmt == Format.txt || cod == CCodec.pln)) {
|
||||||
for (CType typ : ct) {
|
for (CType typ : ct) {
|
||||||
String fn =
|
String fn =
|
||||||
fmt.name().toUpperCase() + "_" +
|
fmt.name().toUpperCase(Locale.ENGLISH) + "_" +
|
||||||
cod.name().toUpperCase() + "_" +
|
cod.name().toUpperCase(Locale.ENGLISH) + "_" +
|
||||||
typ.name().toUpperCase();
|
typ.name().toUpperCase(Locale.ENGLISH);
|
||||||
typ.configure(job);
|
typ.configure(job);
|
||||||
System.out.print(rwop.name().toUpperCase() + " " + fn + ": ");
|
System.out.print(
|
||||||
|
rwop.name().toUpperCase(Locale.ENGLISH) + " " + fn + ": ");
|
||||||
System.out.println(rwop.exec(fn, job) / 1000 +
|
System.out.println(rwop.exec(fn, job) / 1000 +
|
||||||
" seconds");
|
" seconds");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String fn =
|
String fn =
|
||||||
fmt.name().toUpperCase() + "_" +
|
fmt.name().toUpperCase(Locale.ENGLISH) + "_" +
|
||||||
cod.name().toUpperCase();
|
cod.name().toUpperCase(Locale.ENGLISH);
|
||||||
Path p = new Path(root, fn);
|
Path p = new Path(root, fn);
|
||||||
if (rwop == RW.r && !fs.exists(p)) {
|
if (rwop == RW.r && !fs.exists(p)) {
|
||||||
fn += cod.getExt();
|
fn += cod.getExt();
|
||||||
}
|
}
|
||||||
System.out.print(rwop.name().toUpperCase() + " " + fn + ": ");
|
System.out.print(
|
||||||
|
rwop.name().toUpperCase(Locale.ENGLISH) + " " + fn + ": ");
|
||||||
System.out.println(rwop.exec(fn, job) / 1000 +
|
System.out.println(rwop.exec(fn, job) / 1000 +
|
||||||
" seconds");
|
" seconds");
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
@ -280,7 +281,7 @@ public void configure(JobConf conf) {
|
|||||||
public void map(WritableComparable key, Text value,
|
public void map(WritableComparable key, Text value,
|
||||||
OutputCollector<Text, Text> output,
|
OutputCollector<Text, Text> output,
|
||||||
Reporter reporter) throws IOException {
|
Reporter reporter) throws IOException {
|
||||||
String str = value.toString().toLowerCase();
|
String str = value.toString().toLowerCase(Locale.ENGLISH);
|
||||||
output.collect(new Text(str), value);
|
output.collect(new Text(str), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -102,7 +103,7 @@ private void startHsqldbServer() {
|
|||||||
|
|
||||||
private void createConnection(String driverClassName
|
private void createConnection(String driverClassName
|
||||||
, String url) throws Exception {
|
, String url) throws Exception {
|
||||||
if(driverClassName.toLowerCase().contains("oracle")) {
|
if(driverClassName.toLowerCase(Locale.ENGLISH).contains("oracle")) {
|
||||||
isOracle = true;
|
isOracle = true;
|
||||||
}
|
}
|
||||||
Class.forName(driverClassName);
|
Class.forName(driverClassName);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -329,7 +330,8 @@ public int compare(File lhs, File rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String normalizePath(File file) {
|
private String normalizePath(File file) {
|
||||||
return file.getPath().toUpperCase().replaceAll("\\\\", "/");
|
return file.getPath().toUpperCase(Locale.ENGLISH)
|
||||||
|
.replaceAll("\\\\", "/");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
byte[] md5 = computeMD5(files);
|
byte[] md5 = computeMD5(files);
|
||||||
|
@ -979,8 +979,8 @@ private static String trim(String s, String toTrim) {
|
|||||||
private String verifyAndConvertToStandardFormat(String rawDir) throws URISyntaxException {
|
private String verifyAndConvertToStandardFormat(String rawDir) throws URISyntaxException {
|
||||||
URI asUri = new URI(rawDir);
|
URI asUri = new URI(rawDir);
|
||||||
if (asUri.getAuthority() == null
|
if (asUri.getAuthority() == null
|
||||||
|| asUri.getAuthority().toLowerCase(Locale.US).equalsIgnoreCase(
|
|| asUri.getAuthority().toLowerCase(Locale.ENGLISH).equalsIgnoreCase(
|
||||||
sessionUri.getAuthority().toLowerCase(Locale.US))) {
|
sessionUri.getAuthority().toLowerCase(Locale.ENGLISH))) {
|
||||||
// Applies to me.
|
// Applies to me.
|
||||||
return trim(asUri.getPath(), "/");
|
return trim(asUri.getPath(), "/");
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,8 +121,9 @@ public static long getLong(Configuration configuration, String label) {
|
|||||||
*/
|
*/
|
||||||
public static Class<? extends InputFormat> getStrategy(Configuration conf,
|
public static Class<? extends InputFormat> getStrategy(Configuration conf,
|
||||||
DistCpOptions options) {
|
DistCpOptions options) {
|
||||||
String confLabel = "distcp." +
|
String confLabel = "distcp."
|
||||||
options.getCopyStrategy().toLowerCase(Locale.getDefault()) + ".strategy.impl";
|
+ options.getCopyStrategy().toLowerCase(Locale.ENGLISH)
|
||||||
|
+ ".strategy.impl";
|
||||||
return conf.getClass(confLabel, UniformSizeInputFormat.class, InputFormat.class);
|
return conf.getClass(confLabel, UniformSizeInputFormat.class, InputFormat.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +222,8 @@ public static void preserve(FileSystem targetFS, Path path,
|
|||||||
|
|
||||||
final boolean preserveXAttrs = attributes.contains(FileAttribute.XATTR);
|
final boolean preserveXAttrs = attributes.contains(FileAttribute.XATTR);
|
||||||
if (preserveXAttrs || preserveRawXattrs) {
|
if (preserveXAttrs || preserveRawXattrs) {
|
||||||
final String rawNS = XAttr.NameSpace.RAW.name().toLowerCase();
|
final String rawNS =
|
||||||
|
XAttr.NameSpace.RAW.name().toLowerCase(Locale.ENGLISH);
|
||||||
Map<String, byte[]> srcXAttrs = srcFileStatus.getXAttrs();
|
Map<String, byte[]> srcXAttrs = srcFileStatus.getXAttrs();
|
||||||
Map<String, byte[]> targetXAttrs = getXAttrs(targetFS, path);
|
Map<String, byte[]> targetXAttrs = getXAttrs(targetFS, path);
|
||||||
if (srcXAttrs != null && !srcXAttrs.equals(targetXAttrs)) {
|
if (srcXAttrs != null && !srcXAttrs.equals(targetXAttrs)) {
|
||||||
@ -321,7 +323,8 @@ public static CopyListingFileStatus toCopyListingFileStatus(
|
|||||||
copyListingFileStatus.setXAttrs(srcXAttrs);
|
copyListingFileStatus.setXAttrs(srcXAttrs);
|
||||||
} else {
|
} else {
|
||||||
Map<String, byte[]> trgXAttrs = Maps.newHashMap();
|
Map<String, byte[]> trgXAttrs = Maps.newHashMap();
|
||||||
final String rawNS = XAttr.NameSpace.RAW.name().toLowerCase();
|
final String rawNS =
|
||||||
|
XAttr.NameSpace.RAW.name().toLowerCase(Locale.ENGLISH);
|
||||||
for (Map.Entry<String, byte[]> ent : srcXAttrs.entrySet()) {
|
for (Map.Entry<String, byte[]> ent : srcXAttrs.entrySet()) {
|
||||||
final String xattrName = ent.getKey();
|
final String xattrName = ent.getKey();
|
||||||
if (xattrName.startsWith(rawNS)) {
|
if (xattrName.startsWith(rawNS)) {
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
@ -169,7 +170,9 @@ static enum FileAttribute {
|
|||||||
|
|
||||||
final char symbol;
|
final char symbol;
|
||||||
|
|
||||||
private FileAttribute() {symbol = toString().toLowerCase().charAt(0);}
|
private FileAttribute() {
|
||||||
|
symbol = toString().toLowerCase(Locale.ENGLISH).charAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
static EnumSet<FileAttribute> parse(String s) {
|
static EnumSet<FileAttribute> parse(String s) {
|
||||||
if (s == null || s.length() == 0) {
|
if (s == null || s.length() == 0) {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats;
|
import org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats;
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.Locale;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
enum GridmixJobSubmissionPolicy {
|
enum GridmixJobSubmissionPolicy {
|
||||||
@ -84,6 +85,6 @@ public int getPollingInterval() {
|
|||||||
public static GridmixJobSubmissionPolicy getPolicy(
|
public static GridmixJobSubmissionPolicy getPolicy(
|
||||||
Configuration conf, GridmixJobSubmissionPolicy defaultPolicy) {
|
Configuration conf, GridmixJobSubmissionPolicy defaultPolicy) {
|
||||||
String policy = conf.get(JOB_SUBMISSION_POLICY, defaultPolicy.name());
|
String policy = conf.get(JOB_SUBMISSION_POLICY, defaultPolicy.name());
|
||||||
return valueOf(policy.toUpperCase());
|
return valueOf(policy.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -319,42 +320,43 @@ private int initializeHadoopLogsAnalyzer(String[] args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < args.length - (inputFilename == null ? 0 : 1); ++i) {
|
for (int i = 0; i < args.length - (inputFilename == null ? 0 : 1); ++i) {
|
||||||
if ("-h".equals(args[i].toLowerCase())
|
if ("-h".equals(args[i].toLowerCase(Locale.ENGLISH))
|
||||||
|| "-help".equals(args[i].toLowerCase())) {
|
|| "-help".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-c".equals(args[i].toLowerCase())
|
if ("-c".equals(args[i].toLowerCase(Locale.ENGLISH))
|
||||||
|| "-collect-prefixes".equals(args[i].toLowerCase())) {
|
|| "-collect-prefixes".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
collecting = true;
|
collecting = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// these control the job digest
|
// these control the job digest
|
||||||
if ("-write-job-trace".equals(args[i].toLowerCase())) {
|
if ("-write-job-trace".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
++i;
|
++i;
|
||||||
jobTraceFilename = new Path(args[i]);
|
jobTraceFilename = new Path(args[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-single-line-job-traces".equals(args[i].toLowerCase())) {
|
if ("-single-line-job-traces".equals(
|
||||||
|
args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
prettyprintTrace = false;
|
prettyprintTrace = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-omit-task-details".equals(args[i].toLowerCase())) {
|
if ("-omit-task-details".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
omitTaskDetails = true;
|
omitTaskDetails = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-write-topology".equals(args[i].toLowerCase())) {
|
if ("-write-topology".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
++i;
|
++i;
|
||||||
topologyFilename = new Path(args[i]);
|
topologyFilename = new Path(args[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-job-digest-spectra".equals(args[i].toLowerCase())) {
|
if ("-job-digest-spectra".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
ArrayList<Integer> values = new ArrayList<Integer>();
|
ArrayList<Integer> values = new ArrayList<Integer>();
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
@ -384,13 +386,13 @@ private int initializeHadoopLogsAnalyzer(String[] args)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-d".equals(args[i].toLowerCase())
|
if ("-d".equals(args[i].toLowerCase(Locale.ENGLISH))
|
||||||
|| "-debug".equals(args[i].toLowerCase())) {
|
|| "-debug".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
debug = true;
|
debug = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-spreads".equals(args[i].toLowerCase())) {
|
if ("-spreads".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
int min = Integer.parseInt(args[i + 1]);
|
int min = Integer.parseInt(args[i + 1]);
|
||||||
int max = Integer.parseInt(args[i + 2]);
|
int max = Integer.parseInt(args[i + 2]);
|
||||||
|
|
||||||
@ -404,22 +406,22 @@ private int initializeHadoopLogsAnalyzer(String[] args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These control log-wide CDF outputs
|
// These control log-wide CDF outputs
|
||||||
if ("-delays".equals(args[i].toLowerCase())) {
|
if ("-delays".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
delays = true;
|
delays = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-runtimes".equals(args[i].toLowerCase())) {
|
if ("-runtimes".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
runtimes = true;
|
runtimes = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-tasktimes".equals(args[i].toLowerCase())) {
|
if ("-tasktimes".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
collectTaskTimes = true;
|
collectTaskTimes = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-v1".equals(args[i].toLowerCase())) {
|
if ("-v1".equals(args[i].toLowerCase(Locale.ENGLISH))) {
|
||||||
version = 1;
|
version = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
@ -433,7 +434,7 @@ private static Values getPre21Value(String name) {
|
|||||||
return Values.SUCCESS;
|
return Values.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Values.valueOf(name.toUpperCase());
|
return Values.valueOf(name.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processTaskUpdatedEvent(TaskUpdatedEvent event) {
|
private void processTaskUpdatedEvent(TaskUpdatedEvent event) {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@ -243,7 +244,7 @@ public void incorporateCounters(JhCounters counters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String canonicalizeCounterName(String nonCanonicalName) {
|
private static String canonicalizeCounterName(String nonCanonicalName) {
|
||||||
String result = nonCanonicalName.toLowerCase();
|
String result = nonCanonicalName.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
result = result.replace(' ', '|');
|
result = result.replace(' ', '|');
|
||||||
result = result.replace('-', '|');
|
result = result.replace('-', '|');
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@ -611,7 +612,7 @@ void setResourceUsageMetrics(ResourceUsageMetrics metrics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String canonicalizeCounterName(String nonCanonicalName) {
|
private static String canonicalizeCounterName(String nonCanonicalName) {
|
||||||
String result = nonCanonicalName.toLowerCase();
|
String result = nonCanonicalName.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
result = result.replace(' ', '|');
|
result = result.replace(' ', '|');
|
||||||
result = result.replace('-', '|');
|
result = result.replace('-', '|');
|
||||||
|
@ -43,7 +43,7 @@ public Environment() throws IOException {
|
|||||||
// http://lopica.sourceforge.net/os.html
|
// http://lopica.sourceforge.net/os.html
|
||||||
String command = null;
|
String command = null;
|
||||||
String OS = System.getProperty("os.name");
|
String OS = System.getProperty("os.name");
|
||||||
String lowerOs = OS.toLowerCase();
|
String lowerOs = OS.toLowerCase(Locale.ENGLISH);
|
||||||
if (OS.indexOf("Windows") > -1) {
|
if (OS.indexOf("Windows") > -1) {
|
||||||
command = "cmd /C set";
|
command = "cmd /C set";
|
||||||
} else if (lowerOs.indexOf("ix") > -1 || lowerOs.indexOf("linux") > -1
|
} else if (lowerOs.indexOf("ix") > -1 || lowerOs.indexOf("linux") > -1
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
@ -173,7 +174,7 @@ public int run(String[] args) throws Exception {
|
|||||||
if (types != null) {
|
if (types != null) {
|
||||||
for (String type : types) {
|
for (String type : types) {
|
||||||
if (!type.trim().isEmpty()) {
|
if (!type.trim().isEmpty()) {
|
||||||
appTypes.add(type.toUpperCase().trim());
|
appTypes.add(type.toUpperCase(Locale.ENGLISH).trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +193,7 @@ public int run(String[] args) throws Exception {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
appStates.add(YarnApplicationState.valueOf(state
|
appStates.add(YarnApplicationState.valueOf(state
|
||||||
.toUpperCase().trim()));
|
.toUpperCase(Locale.ENGLISH).trim()));
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
sysout.println("The application state " + state
|
sysout.println("The application state " + state
|
||||||
+ " is invalid.");
|
+ " is invalid.");
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
@ -110,7 +111,8 @@ public int run(String[] args) throws Exception {
|
|||||||
if (types != null) {
|
if (types != null) {
|
||||||
for (String type : types) {
|
for (String type : types) {
|
||||||
if (!type.trim().isEmpty()) {
|
if (!type.trim().isEmpty()) {
|
||||||
nodeStates.add(NodeState.valueOf(type.trim().toUpperCase()));
|
nodeStates.add(
|
||||||
|
NodeState.valueOf(type.trim().toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.math.LongRange;
|
import org.apache.commons.lang.math.LongRange;
|
||||||
@ -213,7 +214,7 @@ public void setApplicationTags(Set<String> tags) {
|
|||||||
// Convert applicationTags to lower case and add
|
// Convert applicationTags to lower case and add
|
||||||
this.applicationTags = new HashSet<String>();
|
this.applicationTags = new HashSet<String>();
|
||||||
for (String tag : tags) {
|
for (String tag : tags) {
|
||||||
this.applicationTags.add(tag.toLowerCase());
|
this.applicationTags.add(tag.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +259,8 @@ public void setApplicationStates(EnumSet<YarnApplicationState> applicationStates
|
|||||||
public void setApplicationStates(Set<String> applicationStates) {
|
public void setApplicationStates(Set<String> applicationStates) {
|
||||||
EnumSet<YarnApplicationState> appStates = null;
|
EnumSet<YarnApplicationState> appStates = null;
|
||||||
for (YarnApplicationState state : YarnApplicationState.values()) {
|
for (YarnApplicationState state : YarnApplicationState.values()) {
|
||||||
if (applicationStates.contains(state.name().toLowerCase())) {
|
if (applicationStates.contains(
|
||||||
|
state.name().toLowerCase(Locale.ENGLISH))) {
|
||||||
if (appStates == null) {
|
if (appStates == null) {
|
||||||
appStates = EnumSet.of(state);
|
appStates = EnumSet.of(state);
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.hadoop.yarn.api.records.impl.pb;
|
package org.apache.hadoop.yarn.api.records.impl.pb;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
@ -291,7 +292,7 @@ public void setApplicationTags(Set<String> tags) {
|
|||||||
// Convert applicationTags to lower case and add
|
// Convert applicationTags to lower case and add
|
||||||
this.applicationTags = new HashSet<String>();
|
this.applicationTags = new HashSet<String>();
|
||||||
for (String tag : tags) {
|
for (String tag : tags) {
|
||||||
this.applicationTags.add(tag.toLowerCase());
|
this.applicationTags.add(tag.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,8 @@ void genFactoryMethod(String retName, String methodName, int indent) {
|
|||||||
puts(indent, "\n",
|
puts(indent, "\n",
|
||||||
"private <T extends _> ", retName, "<T> ", methodName,
|
"private <T extends _> ", retName, "<T> ", methodName,
|
||||||
"_(T e, boolean inline) {\n",
|
"_(T e, boolean inline) {\n",
|
||||||
" return new ", retName, "<T>(\"", retName.toLowerCase(Locale.US),
|
" return new ", retName, "<T>(\"",
|
||||||
|
retName.toLowerCase(Locale.ENGLISH),
|
||||||
"\", e, opt(", !endTagOptional.contains(retName), ", inline, ",
|
"\", e, opt(", !endTagOptional.contains(retName), ", inline, ",
|
||||||
retName.equals("PRE"), ")); }");
|
retName.equals("PRE"), ")); }");
|
||||||
}
|
}
|
||||||
@ -258,7 +259,7 @@ void genNewElementMethod(String className, Method method, int indent) {
|
|||||||
puts(0, ") {");
|
puts(0, ") {");
|
||||||
puts(indent,
|
puts(indent,
|
||||||
topMode ? "" : " closeAttrs();\n",
|
topMode ? "" : " closeAttrs();\n",
|
||||||
" return ", retName.toLowerCase(Locale.US), "_(this, ",
|
" return ", retName.toLowerCase(Locale.ENGLISH), "_(this, ",
|
||||||
isInline(className, retName), ");\n", "}");
|
isInline(className, retName), ");\n", "}");
|
||||||
} else if (params.length == 1) {
|
} else if (params.length == 1) {
|
||||||
puts(0, "String selector) {");
|
puts(0, "String selector) {");
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
|
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -147,7 +148,8 @@ public ContainerInfo getContainer(@Context HttpServletRequest req,
|
|||||||
}
|
}
|
||||||
Set<String> appStates = parseQueries(statesQuery, true);
|
Set<String> appStates = parseQueries(statesQuery, true);
|
||||||
for (String appState : appStates) {
|
for (String appState : appStates) {
|
||||||
switch (YarnApplicationState.valueOf(appState.toUpperCase())) {
|
switch (YarnApplicationState.valueOf(
|
||||||
|
appState.toUpperCase(Locale.ENGLISH))) {
|
||||||
case FINISHED:
|
case FINISHED:
|
||||||
case FAILED:
|
case FAILED:
|
||||||
case KILLED:
|
case KILLED:
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@ -417,7 +418,7 @@ private static EnumSet<Field> parseFieldsStr(String str, String delimiter) {
|
|||||||
String[] strs = str.split(delimiter);
|
String[] strs = str.split(delimiter);
|
||||||
List<Field> fieldList = new ArrayList<Field>();
|
List<Field> fieldList = new ArrayList<Field>();
|
||||||
for (String s : strs) {
|
for (String s : strs) {
|
||||||
s = s.trim().toUpperCase();
|
s = s.trim().toUpperCase(Locale.ENGLISH);
|
||||||
if (s.equals("EVENTS")) {
|
if (s.equals("EVENTS")) {
|
||||||
fieldList.add(Field.EVENTS);
|
fieldList.add(Field.EVENTS);
|
||||||
} else if (s.equals("LASTEVENTONLY")) {
|
} else if (s.equals("LASTEVENTONLY")) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -164,7 +165,7 @@ public Collection<ApplicationReport> run() throws Exception {
|
|||||||
|
|
||||||
if (checkAppStates
|
if (checkAppStates
|
||||||
&& !appStates.contains(appReport.getYarnApplicationState().toString()
|
&& !appStates.contains(appReport.getYarnApplicationState().toString()
|
||||||
.toLowerCase())) {
|
.toLowerCase(Locale.ENGLISH))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (finalStatusQuery != null && !finalStatusQuery.isEmpty()) {
|
if (finalStatusQuery != null && !finalStatusQuery.isEmpty()) {
|
||||||
@ -186,7 +187,7 @@ public Collection<ApplicationReport> run() throws Exception {
|
|||||||
}
|
}
|
||||||
if (checkAppTypes
|
if (checkAppTypes
|
||||||
&& !appTypes.contains(appReport.getApplicationType().trim()
|
&& !appTypes.contains(appReport.getApplicationType().trim()
|
||||||
.toLowerCase())) {
|
.toLowerCase(Locale.ENGLISH))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +369,8 @@ protected void init(HttpServletResponse response) {
|
|||||||
if (isState) {
|
if (isState) {
|
||||||
try {
|
try {
|
||||||
// enum string is in the uppercase
|
// enum string is in the uppercase
|
||||||
YarnApplicationState.valueOf(paramStr.trim().toUpperCase());
|
YarnApplicationState.valueOf(
|
||||||
|
paramStr.trim().toUpperCase(Locale.ENGLISH));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
YarnApplicationState[] stateArray =
|
YarnApplicationState[] stateArray =
|
||||||
YarnApplicationState.values();
|
YarnApplicationState.values();
|
||||||
@ -378,7 +380,7 @@ protected void init(HttpServletResponse response) {
|
|||||||
+ allAppStates);
|
+ allAppStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.add(paramStr.trim().toLowerCase());
|
params.add(paramStr.trim().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -754,7 +755,7 @@ public void remove() {
|
|||||||
if (applicationTypes != null && !applicationTypes.isEmpty()) {
|
if (applicationTypes != null && !applicationTypes.isEmpty()) {
|
||||||
String appTypeToMatch = caseSensitive
|
String appTypeToMatch = caseSensitive
|
||||||
? application.getApplicationType()
|
? application.getApplicationType()
|
||||||
: application.getApplicationType().toLowerCase();
|
: application.getApplicationType().toLowerCase(Locale.ENGLISH);
|
||||||
if (!applicationTypes.contains(appTypeToMatch)) {
|
if (!applicationTypes.contains(appTypeToMatch)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.resource;
|
package org.apache.hadoop.yarn.server.resourcemanager.resource;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public String toString() {
|
|||||||
sb.append(", ");
|
sb.append(", ");
|
||||||
}
|
}
|
||||||
ResourceType resourceType = ResourceType.values()[i];
|
ResourceType resourceType = ResourceType.values()[i];
|
||||||
sb.append(resourceType.name().toLowerCase());
|
sb.append(resourceType.name().toLowerCase(Locale.ENGLISH));
|
||||||
sb.append(String.format(" weight=%.1f", getWeight(resourceType)));
|
sb.append(String.format(" weight=%.1f", getWeight(resourceType)));
|
||||||
}
|
}
|
||||||
sb.append(">");
|
sb.append(">");
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
@ -394,7 +395,8 @@ public void setUserLimitFactor(String queue, float userLimitFactor) {
|
|||||||
public QueueState getState(String queue) {
|
public QueueState getState(String queue) {
|
||||||
String state = get(getQueuePrefix(queue) + STATE);
|
String state = get(getQueuePrefix(queue) + STATE);
|
||||||
return (state != null) ?
|
return (state != null) ?
|
||||||
QueueState.valueOf(state.toUpperCase()) : QueueState.RUNNING;
|
QueueState.valueOf(state.toUpperCase(Locale.ENGLISH)) :
|
||||||
|
QueueState.RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessibleNodeLabels(String queue, Set<String> labels) {
|
public void setAccessibleNodeLabels(String queue, Set<String> labels) {
|
||||||
@ -490,7 +492,7 @@ public boolean getReservationContinueLook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getAclKey(QueueACL acl) {
|
private static String getAclKey(QueueACL acl) {
|
||||||
return "acl_" + acl.toString().toLowerCase();
|
return "acl_" + acl.toString().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccessControlList getAcl(String queue, QueueACL acl) {
|
public AccessControlList getAcl(String queue, QueueACL acl) {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -241,7 +242,7 @@ public boolean getUsePortForNodeName() {
|
|||||||
public static Resource parseResourceConfigValue(String val)
|
public static Resource parseResourceConfigValue(String val)
|
||||||
throws AllocationConfigurationException {
|
throws AllocationConfigurationException {
|
||||||
try {
|
try {
|
||||||
val = val.toLowerCase();
|
val = val.toLowerCase(Locale.ENGLISH);
|
||||||
int memory = findResource(val, "mb");
|
int memory = findResource(val, "mb");
|
||||||
int vcores = findResource(val, "vcores");
|
int vcores = findResource(val, "vcores");
|
||||||
return BuilderUtils.newResource(memory, vcores);
|
return BuilderUtils.newResource(memory, vcores);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
|
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.InterfaceAudience.Public;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
import org.apache.hadoop.util.ReflectionUtils;
|
||||||
@ -72,7 +73,7 @@ public static SchedulingPolicy parse(String policy)
|
|||||||
throws AllocationConfigurationException {
|
throws AllocationConfigurationException {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Class clazz;
|
Class clazz;
|
||||||
String text = policy.toLowerCase();
|
String text = policy.toLowerCase(Locale.ENGLISH);
|
||||||
if (text.equalsIgnoreCase(FairSharePolicy.NAME)) {
|
if (text.equalsIgnoreCase(FairSharePolicy.NAME)) {
|
||||||
clazz = FairSharePolicy.class;
|
clazz = FairSharePolicy.class;
|
||||||
} else if (text.equalsIgnoreCase(FifoPolicy.NAME)) {
|
} else if (text.equalsIgnoreCase(FifoPolicy.NAME)) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
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_STATE;
|
||||||
import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_LABEL;
|
import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_LABEL;
|
||||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
|
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
|
||||||
@ -77,7 +78,7 @@ protected void render(Block html) {
|
|||||||
.th(".nodeManagerVersion", "Version")._()._().tbody();
|
.th(".nodeManagerVersion", "Version")._()._().tbody();
|
||||||
NodeState stateFilter = null;
|
NodeState stateFilter = null;
|
||||||
if (type != null && !type.isEmpty()) {
|
if (type != null && !type.isEmpty()) {
|
||||||
stateFilter = NodeState.valueOf(type.toUpperCase());
|
stateFilter = NodeState.valueOf(type.toUpperCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
Collection<RMNode> rmNodes = this.rm.getRMContext().getRMNodes().values();
|
Collection<RMNode> rmNodes = this.rm.getRMContext().getRMNodes().values();
|
||||||
boolean isInactive = false;
|
boolean isInactive = false;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
@ -257,7 +258,8 @@ public NodesInfo getNodes(@QueryParam("states") String states) {
|
|||||||
} else {
|
} else {
|
||||||
acceptedStates = EnumSet.noneOf(NodeState.class);
|
acceptedStates = EnumSet.noneOf(NodeState.class);
|
||||||
for (String stateStr : states.split(",")) {
|
for (String stateStr : states.split(",")) {
|
||||||
acceptedStates.add(NodeState.valueOf(stateStr.toUpperCase()));
|
acceptedStates.add(NodeState.valueOf(
|
||||||
|
stateStr.toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +508,7 @@ public ApplicationStatisticsInfo getAppStatistics(
|
|||||||
// if no states, returns the counts of all RMAppStates
|
// if no states, returns the counts of all RMAppStates
|
||||||
if (states.size() == 0) {
|
if (states.size() == 0) {
|
||||||
for (YarnApplicationState state : YarnApplicationState.values()) {
|
for (YarnApplicationState state : YarnApplicationState.values()) {
|
||||||
states.add(state.toString().toLowerCase());
|
states.add(state.toString().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in case we extend to multiple applicationTypes in the future
|
// in case we extend to multiple applicationTypes in the future
|
||||||
@ -518,8 +520,9 @@ public ApplicationStatisticsInfo getAppStatistics(
|
|||||||
ConcurrentMap<ApplicationId, RMApp> apps = rm.getRMContext().getRMApps();
|
ConcurrentMap<ApplicationId, RMApp> apps = rm.getRMContext().getRMApps();
|
||||||
for (RMApp rmapp : apps.values()) {
|
for (RMApp rmapp : apps.values()) {
|
||||||
YarnApplicationState state = rmapp.createApplicationState();
|
YarnApplicationState state = rmapp.createApplicationState();
|
||||||
String type = rmapp.getApplicationType().trim().toLowerCase();
|
String type =
|
||||||
if (states.contains(state.toString().toLowerCase())) {
|
rmapp.getApplicationType().trim().toLowerCase(Locale.ENGLISH);
|
||||||
|
if (states.contains(state.toString().toLowerCase(Locale.ENGLISH))) {
|
||||||
if (types.contains(ANY)) {
|
if (types.contains(ANY)) {
|
||||||
countApp(scoreboard, state, ANY);
|
countApp(scoreboard, state, ANY);
|
||||||
} else if (types.contains(type)) {
|
} else if (types.contains(type)) {
|
||||||
@ -554,7 +557,8 @@ private static Set<String> parseQueries(
|
|||||||
if (isState) {
|
if (isState) {
|
||||||
try {
|
try {
|
||||||
// enum string is in the uppercase
|
// enum string is in the uppercase
|
||||||
YarnApplicationState.valueOf(paramStr.trim().toUpperCase());
|
YarnApplicationState.valueOf(
|
||||||
|
paramStr.trim().toUpperCase(Locale.ENGLISH));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
YarnApplicationState[] stateArray =
|
YarnApplicationState[] stateArray =
|
||||||
YarnApplicationState.values();
|
YarnApplicationState.values();
|
||||||
@ -564,7 +568,7 @@ private static Set<String> parseQueries(
|
|||||||
+ " specified. It should be one of " + allAppStates);
|
+ " specified. It should be one of " + allAppStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.add(paramStr.trim().toLowerCase());
|
params.add(paramStr.trim().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -582,7 +586,8 @@ private static Map<YarnApplicationState, Map<String, Long>> buildScoreboard(
|
|||||||
for (String state : states) {
|
for (String state : states) {
|
||||||
Map<String, Long> partScoreboard = new HashMap<String, Long>();
|
Map<String, Long> partScoreboard = new HashMap<String, Long>();
|
||||||
scoreboard.put(
|
scoreboard.put(
|
||||||
YarnApplicationState.valueOf(state.toUpperCase()), partScoreboard);
|
YarnApplicationState.valueOf(
|
||||||
|
state.toUpperCase(Locale.ENGLISH)), partScoreboard);
|
||||||
// types is verified no to be empty
|
// types is verified no to be empty
|
||||||
for (String type : types) {
|
for (String type : types) {
|
||||||
partScoreboard.put(type, 0L);
|
partScoreboard.put(type, 0L);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user