HBASE-15889. String case conversions are locale-sensitive, used without locale
Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
parent
60c8f76a9d
commit
3b6e6e6c25
|
@ -21,6 +21,7 @@ import com.sun.javadoc.DocErrorReporter;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
final class StabilityOptions {
|
||||
|
||||
|
@ -31,7 +32,7 @@ final class StabilityOptions {
|
|||
public static final String UNSTABLE_OPTION = "-unstable";
|
||||
|
||||
public static Integer optionLength(String option) {
|
||||
String opt = option.toLowerCase();
|
||||
String opt = option.toLowerCase(Locale.ROOT);
|
||||
if (opt.equals(UNSTABLE_OPTION)) return 1;
|
||||
if (opt.equals(EVOLVING_OPTION)) return 1;
|
||||
if (opt.equals(STABLE_OPTION)) return 1;
|
||||
|
@ -40,7 +41,7 @@ final class StabilityOptions {
|
|||
|
||||
public static void validOptions(String[][] options, DocErrorReporter reporter) {
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
String opt = options[i][0].toLowerCase();
|
||||
String opt = options[i][0].toLowerCase(Locale.ROOT);
|
||||
if (opt.equals(UNSTABLE_OPTION)) {
|
||||
RootDocProcessor.stability = UNSTABLE_OPTION;
|
||||
} else if (opt.equals(EVOLVING_OPTION)) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -331,9 +332,9 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
setInMemoryCompaction(DEFAULT_IN_MEMORY_COMPACTION);
|
||||
setBlockCacheEnabled(DEFAULT_BLOCKCACHE);
|
||||
setTimeToLive(DEFAULT_TTL);
|
||||
setCompressionType(Compression.Algorithm.valueOf(DEFAULT_COMPRESSION.toUpperCase()));
|
||||
setDataBlockEncoding(DataBlockEncoding.valueOf(DEFAULT_DATA_BLOCK_ENCODING.toUpperCase()));
|
||||
setBloomFilterType(BloomType.valueOf(DEFAULT_BLOOMFILTER.toUpperCase()));
|
||||
setCompressionType(Compression.Algorithm.valueOf(DEFAULT_COMPRESSION.toUpperCase(Locale.ROOT)));
|
||||
setDataBlockEncoding(DataBlockEncoding.valueOf(DEFAULT_DATA_BLOCK_ENCODING.toUpperCase(Locale.ROOT)));
|
||||
setBloomFilterType(BloomType.valueOf(DEFAULT_BLOOMFILTER.toUpperCase(Locale.ROOT)));
|
||||
setBlocksize(DEFAULT_BLOCKSIZE);
|
||||
setScope(DEFAULT_REPLICATION_SCOPE);
|
||||
}
|
||||
|
@ -575,7 +576,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
if (n == null) {
|
||||
return Compression.Algorithm.NONE;
|
||||
}
|
||||
return Compression.Algorithm.valueOf(n.toUpperCase());
|
||||
return Compression.Algorithm.valueOf(n.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -587,7 +588,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
* @return this (for chained invocation)
|
||||
*/
|
||||
public HColumnDescriptor setCompressionType(Compression.Algorithm type) {
|
||||
return setValue(COMPRESSION, type.getName().toUpperCase());
|
||||
return setValue(COMPRESSION, type.getName().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -649,7 +650,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
if (n == null) {
|
||||
return getCompressionType();
|
||||
}
|
||||
return Compression.Algorithm.valueOf(n.toUpperCase());
|
||||
return Compression.Algorithm.valueOf(n.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -662,7 +663,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
*/
|
||||
public HColumnDescriptor setCompactionCompressionType(
|
||||
Compression.Algorithm type) {
|
||||
return setValue(COMPRESSION_COMPACT, type.getName().toUpperCase());
|
||||
return setValue(COMPRESSION_COMPACT, type.getName().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -711,7 +712,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
String value = getValue(KEEP_DELETED_CELLS);
|
||||
if (value != null) {
|
||||
// toUpperCase for backwards compatibility
|
||||
return KeepDeletedCells.valueOf(value.toUpperCase());
|
||||
return KeepDeletedCells.valueOf(value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
return DEFAULT_KEEP_DELETED;
|
||||
}
|
||||
|
@ -796,7 +797,7 @@ public class HColumnDescriptor implements Comparable<HColumnDescriptor> {
|
|||
if (n == null) {
|
||||
n = DEFAULT_BLOOMFILTER;
|
||||
}
|
||||
return BloomType.valueOf(n.toUpperCase());
|
||||
return BloomType.valueOf(n.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.apache.hadoop.hbase.filter;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||
|
@ -53,8 +54,8 @@ public class SubstringComparator extends ByteArrayComparable {
|
|||
* @param substr the substring
|
||||
*/
|
||||
public SubstringComparator(String substr) {
|
||||
super(Bytes.toBytes(substr.toLowerCase()));
|
||||
this.substr = substr.toLowerCase();
|
||||
super(Bytes.toBytes(substr.toLowerCase(Locale.ROOT)));
|
||||
this.substr = substr.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,7 +65,7 @@ public class SubstringComparator extends ByteArrayComparable {
|
|||
|
||||
@Override
|
||||
public int compareTo(byte[] value, int offset, int length) {
|
||||
return Bytes.toString(value, offset, length).toLowerCase().contains(substr) ? 0
|
||||
return Bytes.toString(value, offset, length).toLowerCase(Locale.ROOT).contains(substr) ? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.security.PrivilegedExceptionAction;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
@ -262,7 +263,7 @@ public class AsyncRpcChannelImpl implements AsyncRpcChannel {
|
|||
return new SaslClientHandler(realTicket, authMethod, token, serverPrincipal,
|
||||
client.fallbackAllowed,
|
||||
client.conf.get("hbase.rpc.protection",
|
||||
SaslUtil.QualityOfProtection.AUTHENTICATION.name().toLowerCase()),
|
||||
SaslUtil.QualityOfProtection.AUTHENTICATION.name().toLowerCase(Locale.ROOT)),
|
||||
getChannelHeaderBytes(authMethod),
|
||||
new SaslClientHandler.SaslExceptionHandler() {
|
||||
@Override
|
||||
|
@ -479,7 +480,7 @@ public class AsyncRpcChannelImpl implements AsyncRpcChannel {
|
|||
throw new IOException("Can't obtain server Kerberos config key from SecurityInfo");
|
||||
}
|
||||
this.serverPrincipal = SecurityUtil.getServerPrincipal(client.conf.get(serverKey),
|
||||
address.getAddress().getCanonicalHostName().toLowerCase());
|
||||
address.getAddress().getCanonicalHostName().toLowerCase(Locale.ROOT));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("RPC Server Kerberos principal name for service=" + serviceName + " is "
|
||||
+ serverPrincipal);
|
||||
|
|
|
@ -45,6 +45,7 @@ import java.security.PrivilegedExceptionAction;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
@ -331,7 +332,7 @@ public class RpcClientImpl extends AbstractRpcClient {
|
|||
"Can't obtain server Kerberos config key from SecurityInfo");
|
||||
}
|
||||
serverPrincipal = SecurityUtil.getServerPrincipal(
|
||||
conf.get(serverKey), server.getAddress().getCanonicalHostName().toLowerCase());
|
||||
conf.get(serverKey), server.getAddress().getCanonicalHostName().toLowerCase(Locale.ROOT));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("RPC Server Kerberos principal name for service="
|
||||
+ remoteId.getServiceName() + " is " + serverPrincipal);
|
||||
|
@ -618,7 +619,7 @@ public class RpcClientImpl extends AbstractRpcClient {
|
|||
final OutputStream out2) throws IOException {
|
||||
saslRpcClient = new HBaseSaslRpcClient(authMethod, token, serverPrincipal, fallbackAllowed,
|
||||
conf.get("hbase.rpc.protection",
|
||||
QualityOfProtection.AUTHENTICATION.name().toLowerCase()));
|
||||
QualityOfProtection.AUTHENTICATION.name().toLowerCase(Locale.ROOT)));
|
||||
return saslRpcClient.saslConnect(in2, out2);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableSet;
|
||||
|
@ -3447,7 +3448,7 @@ public final class ProtobufUtil {
|
|||
*/
|
||||
public static HBaseProtos.SnapshotDescription.Type
|
||||
createProtosSnapShotDescType(String snapshotDesc) {
|
||||
return HBaseProtos.SnapshotDescription.Type.valueOf(snapshotDesc.toUpperCase());
|
||||
return HBaseProtos.SnapshotDescription.Type.valueOf(snapshotDesc.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -254,7 +255,7 @@ public class PoolMap<K, V> implements Map<K, V> {
|
|||
}
|
||||
|
||||
public static String fuzzyNormalize(String name) {
|
||||
return name != null ? name.replaceAll("-", "").trim().toLowerCase() : "";
|
||||
return name != null ? name.replaceAll("-", "").trim().toLowerCase(Locale.ROOT) : "";
|
||||
}
|
||||
|
||||
public static PoolType fuzzyMatch(String name) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.net.SocketTimeoutException;
|
|||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -410,7 +411,7 @@ public class MetaTableLocator {
|
|||
} else if (cause != null && cause instanceof EOFException) {
|
||||
// Catch. Other end disconnected us.
|
||||
} else if (cause != null && cause.getMessage() != null &&
|
||||
cause.getMessage().toLowerCase().contains("connection reset")) {
|
||||
cause.getMessage().toLowerCase(Locale.ROOT).contains("connection reset")) {
|
||||
// Catch. Connection reset.
|
||||
} else {
|
||||
throw ioe;
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
@ -232,7 +233,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
*/
|
||||
static String getServerName(String hostName, int port, long startcode) {
|
||||
final StringBuilder name = new StringBuilder(hostName.length() + 1 + 5 + 1 + 13);
|
||||
name.append(hostName.toLowerCase());
|
||||
name.append(hostName.toLowerCase(Locale.ROOT));
|
||||
name.append(SERVERNAME_SEPARATOR);
|
||||
name.append(port);
|
||||
name.append(SERVERNAME_SEPARATOR);
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.security.KeyStoreException;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
@ -142,7 +143,7 @@ public class KeyStoreKeyProvider implements KeyProvider {
|
|||
throw new RuntimeException("KeyProvider scheme should specify KeyStore type");
|
||||
}
|
||||
// KeyStore expects instance type specifications in uppercase
|
||||
store = KeyStore.getInstance(storeType.toUpperCase());
|
||||
store = KeyStore.getInstance(storeType.toUpperCase(Locale.ROOT));
|
||||
processParameters(uri);
|
||||
load(uri);
|
||||
} catch (URISyntaxException e) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.apache.hadoop.hbase.ipc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class MetricsHBaseServerSourceFactoryImpl extends MetricsHBaseServerSourc
|
|||
source = new MetricsHBaseServerSourceImpl(
|
||||
context,
|
||||
METRICS_DESCRIPTION,
|
||||
context.toLowerCase(),
|
||||
context.toLowerCase(Locale.ROOT),
|
||||
context + METRICS_JMX_CONTEXT_SUFFIX, wrap);
|
||||
|
||||
//Store back in storage
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.hadoop.metrics2.MetricsTag;
|
|||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -245,6 +246,6 @@ public class MetricsAssertHelperImpl implements MetricsAssertHelper {
|
|||
}
|
||||
|
||||
private String canonicalizeMetricName(String in) {
|
||||
return in.toLowerCase().replaceAll("[^A-Za-z0-9 ]", "");
|
||||
return in.toLowerCase(Locale.ROOT).replaceAll("[^A-Za-z0-9 ]", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -205,7 +206,7 @@ public class HBaseClusterManager extends Configured implements ClusterManager {
|
|||
@Override
|
||||
public String getCommand(ServiceType service, Operation op) {
|
||||
return String.format("%s/bin/hbase-daemon.sh %s %s %s", hbaseHome, confDir,
|
||||
op.toString().toLowerCase(), service);
|
||||
op.toString().toLowerCase(Locale.ROOT), service);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +236,7 @@ public class HBaseClusterManager extends Configured implements ClusterManager {
|
|||
@Override
|
||||
public String getCommand(ServiceType service, Operation op) {
|
||||
return String.format("%s/sbin/hadoop-daemon.sh %s %s %s", hadoopHome, confDir,
|
||||
op.toString().toLowerCase(), service);
|
||||
op.toString().toLowerCase(Locale.ROOT), service);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +265,7 @@ public class HBaseClusterManager extends Configured implements ClusterManager {
|
|||
|
||||
@Override
|
||||
public String getCommand(ServiceType service, Operation op) {
|
||||
return String.format("%s/bin/zkServer.sh %s", zookeeperHome, op.toString().toLowerCase());
|
||||
return String.format("%s/bin/zkServer.sh %s", zookeeperHome, op.toString().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,6 +37,7 @@ import javax.xml.ws.http.HTTPException;
|
|||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -274,8 +275,8 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
|
|||
if (role.get("hostRef").get("hostId").getTextValue().equals(hostId) &&
|
||||
role.get("type")
|
||||
.getTextValue()
|
||||
.toLowerCase()
|
||||
.equals(roleType.toLowerCase())) {
|
||||
.toLowerCase(Locale.ROOT)
|
||||
.equals(roleType.toLowerCase(Locale.ROOT))) {
|
||||
roleValue = role.get(property).getTextValue();
|
||||
break;
|
||||
}
|
||||
|
@ -328,7 +329,7 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
|
|||
// APIs tend to take commands in lowercase, so convert them to save the trouble later.
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase();
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,4 +349,4 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
|
|||
private enum Service {
|
||||
HBASE, HDFS, MAPREDUCE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.hadoop.hbase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
|
@ -111,7 +112,7 @@ public class StripeCompactionsPerformanceEvaluation extends AbstractHBaseTool {
|
|||
} else {
|
||||
minValueSize = maxValueSize = Integer.parseInt(valueSize);
|
||||
}
|
||||
String datagen = cmd.getOptionValue(DATAGEN_KEY, "default").toLowerCase();
|
||||
String datagen = cmd.getOptionValue(DATAGEN_KEY, "default").toLowerCase(Locale.ROOT);
|
||||
if ("default".equals(datagen)) {
|
||||
dataGen = new MultiThreadedAction.DefaultDataGenerator(
|
||||
minValueSize, maxValueSize, 1, 1, new byte[][] { COLUMN_FAMILY });
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.rest.filter;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
@ -65,11 +66,11 @@ public class GzipFilter implements Filter {
|
|||
String acceptEncoding = request.getHeader("accept-encoding");
|
||||
String contentType = request.getHeader("content-type");
|
||||
if ((contentEncoding != null) &&
|
||||
(contentEncoding.toLowerCase().indexOf("gzip") > -1)) {
|
||||
(contentEncoding.toLowerCase(Locale.ROOT).indexOf("gzip") > -1)) {
|
||||
request = new GZIPRequestWrapper(request);
|
||||
}
|
||||
if (((acceptEncoding != null) &&
|
||||
(acceptEncoding.toLowerCase().indexOf("gzip") > -1)) ||
|
||||
(acceptEncoding.toLowerCase(Locale.ROOT).indexOf("gzip") > -1)) ||
|
||||
((contentType != null) && mimeTypes.contains(contentType))) {
|
||||
response = new GZIPResponseWrapper(response);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.ipc;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -221,7 +222,7 @@ public abstract class RpcExecutor {
|
|||
*/
|
||||
public void resizeQueues(Configuration conf) {
|
||||
String configKey = RpcScheduler.IPC_SERVER_MAX_CALLQUEUE_LENGTH;
|
||||
if (name != null && name.toLowerCase().contains("priority")) {
|
||||
if (name != null && name.toLowerCase(Locale.ROOT).contains("priority")) {
|
||||
configKey = RpcScheduler.IPC_SERVER_PRIORITY_MAX_CALLQUEUE_LENGTH;
|
||||
}
|
||||
currentQueueLimit = conf.getInt(configKey, currentQueueLimit);
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
|
@ -401,7 +402,7 @@ public class Import extends Configured implements Tool {
|
|||
filter = instantiateFilter(conf);
|
||||
String durabilityStr = conf.get(WAL_DURABILITY);
|
||||
if(durabilityStr != null){
|
||||
durability = Durability.valueOf(durabilityStr.toUpperCase());
|
||||
durability = Durability.valueOf(durabilityStr.toUpperCase(Locale.ROOT));
|
||||
LOG.info("setting WAL durability to " + durability);
|
||||
} else {
|
||||
LOG.info("setting WAL durability to default.");
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.mapreduce;
|
|||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -253,7 +254,7 @@ implements Configurable {
|
|||
@Override
|
||||
public List<InputSplit> getSplits(JobContext context) throws IOException {
|
||||
List<InputSplit> splits = super.getSplits(context);
|
||||
if ((conf.get(SHUFFLE_MAPS) != null) && "true".equals(conf.get(SHUFFLE_MAPS).toLowerCase())) {
|
||||
if ((conf.get(SHUFFLE_MAPS) != null) && "true".equals(conf.get(SHUFFLE_MAPS).toLowerCase(Locale.ROOT))) {
|
||||
Collections.shuffle(splits);
|
||||
}
|
||||
return splits;
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
@ -61,7 +62,7 @@ implements RowProcessor<S,T> {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getClass().getSimpleName().toLowerCase();
|
||||
return this.getClass().getSimpleName().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.security;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.security.auth.callback.Callback;
|
||||
|
@ -53,7 +54,7 @@ public class HBaseSaslRpcServer {
|
|||
|
||||
public static void init(Configuration conf) {
|
||||
saslProps = SaslUtil.initSaslProperties(conf.get("hbase.rpc.protection",
|
||||
QualityOfProtection.AUTHENTICATION.name().toLowerCase()));
|
||||
QualityOfProtection.AUTHENTICATION.name().toLowerCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
public static Map<String, String> getSaslProps() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.hadoop.hbase.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -53,7 +54,7 @@ public class CompressionTest {
|
|||
private static final Log LOG = LogFactory.getLog(CompressionTest.class);
|
||||
|
||||
public static boolean testCompression(String codec) {
|
||||
codec = codec.toLowerCase();
|
||||
codec = codec.toLowerCase(Locale.ROOT);
|
||||
|
||||
Compression.Algorithm a;
|
||||
|
||||
|
@ -109,7 +110,7 @@ public class CompressionTest {
|
|||
|
||||
System.err.println(
|
||||
"Usage: CompressionTest <path> " +
|
||||
StringUtils.join( Compression.Algorithm.values(), "|").toLowerCase() +
|
||||
StringUtils.join( Compression.Algorithm.values(), "|").toLowerCase(Locale.ROOT) +
|
||||
"\n" +
|
||||
"For example:\n" +
|
||||
" hbase " + CompressionTest.class + " file:///tmp/testfile gz\n");
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.management.JMException;
|
||||
import javax.management.MBeanServer;
|
||||
|
@ -87,7 +88,7 @@ public class DirectMemoryUtils {
|
|||
long multiplier = 1; //for the byte case.
|
||||
for (String s : arguments) {
|
||||
if (s.contains("-XX:MaxDirectMemorySize=")) {
|
||||
String memSize = s.toLowerCase()
|
||||
String memSize = s.toLowerCase(Locale.ROOT)
|
||||
.replace("-xx:maxdirectmemorysize=", "").trim();
|
||||
|
||||
if (memSize.contains("k")) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -121,7 +122,7 @@ public abstract class FSUtils {
|
|||
*/
|
||||
public static void setStoragePolicy(final FileSystem fs, final Configuration conf,
|
||||
final Path path, final String policyKey, final String defaultPolicy) {
|
||||
String storagePolicy = conf.get(policyKey, defaultPolicy).toUpperCase();
|
||||
String storagePolicy = conf.get(policyKey, defaultPolicy).toUpperCase(Locale.ROOT);
|
||||
if (storagePolicy.equals(defaultPolicy)) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("default policy of " + defaultPolicy + " requested, exiting early.");
|
||||
|
@ -1912,7 +1913,7 @@ public abstract class FSUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!regionName.toLowerCase().matches("[0-9a-f]+")) {
|
||||
if (!regionName.toLowerCase(Locale.ROOT).matches("[0-9a-f]+")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
@ -4067,7 +4068,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
errors.progress();
|
||||
String encodedName = regionDir.getPath().getName();
|
||||
// ignore directories that aren't hexadecimal
|
||||
if (!encodedName.toLowerCase().matches("[0-9a-f]+")) {
|
||||
if (!encodedName.toLowerCase(Locale.ROOT).matches("[0-9a-f]+")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -975,7 +976,7 @@ public class RegionMover extends AbstractHBaseTool {
|
|||
if (cmd.hasOption('t')) {
|
||||
rmbuilder.timeout(Integer.parseInt(cmd.getOptionValue('t')));
|
||||
}
|
||||
this.loadUnload = cmd.getOptionValue("o").toLowerCase();
|
||||
this.loadUnload = cmd.getOptionValue("o").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.lang.management.ManagementFactory;
|
|||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -103,8 +104,8 @@ public abstract class ServerCommandLine extends Configured implements Tool {
|
|||
|
||||
nextEnv:
|
||||
for (Entry<String, String> entry : System.getenv().entrySet()) {
|
||||
String key = entry.getKey().toLowerCase();
|
||||
String value = entry.getValue().toLowerCase();
|
||||
String key = entry.getKey().toLowerCase(Locale.ROOT);
|
||||
String value = entry.getValue().toLowerCase(Locale.ROOT);
|
||||
// exclude variables which may contain skip words
|
||||
for(String skipWord : skipWords) {
|
||||
if (key.contains(skipWord) || value.contains(skipWord))
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
|
@ -310,8 +311,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
static boolean checkTable(Admin admin, TestOptions opts) throws IOException {
|
||||
TableName tableName = TableName.valueOf(opts.tableName);
|
||||
boolean needsDelete = false, exists = admin.tableExists(tableName);
|
||||
boolean isReadCmd = opts.cmdName.toLowerCase().contains("read")
|
||||
|| opts.cmdName.toLowerCase().contains("scan");
|
||||
boolean isReadCmd = opts.cmdName.toLowerCase(Locale.ROOT).contains("read")
|
||||
|| opts.cmdName.toLowerCase(Locale.ROOT).contains("scan");
|
||||
if (!exists && isReadCmd) {
|
||||
throw new IllegalStateException(
|
||||
"Must specify an existing table for read commands. Run a write command first.");
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.net.InetAddress;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -124,7 +125,7 @@ public class TestIPv6NIOServerSocketChannel {
|
|||
//java.net.SocketException: Address family not supported by protocol family
|
||||
//or java.net.SocketException: Protocol family not supported
|
||||
Assert.assertFalse(ex.getClass().isInstance(BindException.class));
|
||||
Assert.assertTrue(ex.getMessage().toLowerCase().contains("protocol family"));
|
||||
Assert.assertTrue(ex.getMessage().toLowerCase(Locale.ROOT).contains("protocol family"));
|
||||
LOG.info("Received expected exception:");
|
||||
LOG.info(ex);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.lang.management.ThreadMXBean;
|
|||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
@ -93,7 +94,7 @@ public class TimedOutTestsListener extends RunListener {
|
|||
thread.getPriority(),
|
||||
thread.getId(),
|
||||
Thread.State.WAITING.equals(thread.getState()) ?
|
||||
"in Object.wait()" : thread.getState().name().toLowerCase(),
|
||||
"in Object.wait()" : thread.getState().name().toLowerCase(Locale.ROOT),
|
||||
Thread.State.WAITING.equals(thread.getState()) ?
|
||||
"WAITING (on object monitor)" : thread.getState()));
|
||||
for (StackTraceElement stackTraceElement : e.getValue()) {
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
|
||||
|
@ -225,8 +226,8 @@ public abstract class MultiTableInputFormatTestBase {
|
|||
private void testScan(String start, String stop, String last)
|
||||
throws IOException, InterruptedException, ClassNotFoundException {
|
||||
String jobName =
|
||||
"Scan" + (start != null ? start.toUpperCase() : "Empty") + "To" +
|
||||
(stop != null ? stop.toUpperCase() : "Empty");
|
||||
"Scan" + (start != null ? start.toUpperCase(Locale.ROOT) : "Empty") + "To" +
|
||||
(stop != null ? stop.toUpperCase(Locale.ROOT) : "Empty");
|
||||
LOG.info("Before map/reduce startup - job " + jobName);
|
||||
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -374,7 +375,7 @@ public class TestLoadIncrementalHFiles {
|
|||
// set real family name to upper case in purpose to simulate the case that
|
||||
// family name in HFiles is invalid
|
||||
HColumnDescriptor family =
|
||||
new HColumnDescriptor(Bytes.toBytes(new String(FAMILY).toUpperCase()));
|
||||
new HColumnDescriptor(Bytes.toBytes(new String(FAMILY).toUpperCase(Locale.ROOT)));
|
||||
htd.addFamily(family);
|
||||
|
||||
try {
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
|
||||
|
@ -176,8 +177,8 @@ public abstract class TestTableInputFormatScanBase {
|
|||
*/
|
||||
protected void testScanFromConfiguration(String start, String stop, String last)
|
||||
throws IOException, InterruptedException, ClassNotFoundException {
|
||||
String jobName = "ScanFromConfig" + (start != null ? start.toUpperCase() : "Empty") +
|
||||
"To" + (stop != null ? stop.toUpperCase() : "Empty");
|
||||
String jobName = "ScanFromConfig" + (start != null ? start.toUpperCase(Locale.ROOT) : "Empty") +
|
||||
"To" + (stop != null ? stop.toUpperCase(Locale.ROOT) : "Empty");
|
||||
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
|
||||
c.set(TableInputFormat.INPUT_TABLE, TABLE_NAME.getNameAsString());
|
||||
c.set(TableInputFormat.SCAN_COLUMN_FAMILY, Bytes.toString(INPUT_FAMILY));
|
||||
|
@ -213,8 +214,8 @@ public abstract class TestTableInputFormatScanBase {
|
|||
*/
|
||||
protected void testScan(String start, String stop, String last)
|
||||
throws IOException, InterruptedException, ClassNotFoundException {
|
||||
String jobName = "Scan" + (start != null ? start.toUpperCase() : "Empty") +
|
||||
"To" + (stop != null ? stop.toUpperCase() : "Empty");
|
||||
String jobName = "Scan" + (start != null ? start.toUpperCase(Locale.ROOT) : "Empty") +
|
||||
"To" + (stop != null ? stop.toUpperCase(Locale.ROOT) : "Empty");
|
||||
LOG.info("Before map/reduce startup - job " + jobName);
|
||||
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
|
||||
Scan scan = new Scan();
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.text.DecimalFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
|
@ -142,7 +143,7 @@ public class DataBlockEncodingTool {
|
|||
String s = super.toString();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(s.charAt(0));
|
||||
sb.append(s.substring(1).toLowerCase());
|
||||
sb.append(s.substring(1).toLowerCase(Locale.ROOT));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +373,7 @@ public class DataBlockEncodingTool {
|
|||
private void benchmarkDefaultCompression(int totalSize, byte[] rawBuffer)
|
||||
throws IOException {
|
||||
benchmarkAlgorithm(compressionAlgorithm,
|
||||
compressionAlgorithmName.toUpperCase(), rawBuffer, 0, totalSize);
|
||||
compressionAlgorithmName.toUpperCase(Locale.ROOT), rawBuffer, 0, totalSize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,7 +527,7 @@ public class DataBlockEncodingTool {
|
|||
* @throws IOException
|
||||
*/
|
||||
public void displayStatistics() throws IOException {
|
||||
final String comprAlgo = compressionAlgorithmName.toUpperCase();
|
||||
final String comprAlgo = compressionAlgorithmName.toUpperCase(Locale.ROOT);
|
||||
long rawBytes = totalKeyLength + totalPrefixLength + totalValueLength;
|
||||
|
||||
System.out.println("Raw data size:");
|
||||
|
@ -695,7 +696,7 @@ public class DataBlockEncodingTool {
|
|||
String compressionName = DEFAULT_COMPRESSION.getName();
|
||||
if (cmd.hasOption(OPT_ENCODING_ALGORITHM)) {
|
||||
compressionName =
|
||||
cmd.getOptionValue(OPT_ENCODING_ALGORITHM).toLowerCase();
|
||||
cmd.getOptionValue(OPT_ENCODING_ALGORITHM).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
boolean doBenchmark = cmd.hasOption(OPT_MEASURE_THROUGHPUT);
|
||||
boolean doVerify = !cmd.hasOption(OPT_OMIT_CORRECTNESS_TEST);
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.net.InetAddress;
|
|||
import java.net.NetworkInterface;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -92,7 +93,7 @@ public class TestRegionServerHostname {
|
|||
assertTrue(servers.size() == NUM_RS+1);
|
||||
for (String server : servers) {
|
||||
assertTrue("From zookeeper: " + server + " hostname: " + hostName,
|
||||
server.startsWith(hostName.toLowerCase()+","));
|
||||
server.startsWith(hostName.toLowerCase(Locale.ROOT)+","));
|
||||
}
|
||||
zkw.close();
|
||||
} finally {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.security.SecureRandom;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
@ -124,7 +125,7 @@ public class LoadTestTool extends AbstractHBaseTool {
|
|||
public static final String OPT_DEFERRED_LOG_FLUSH_USAGE = "Enable deferred log flush.";
|
||||
|
||||
public static final String OPT_DATA_BLOCK_ENCODING =
|
||||
HColumnDescriptor.DATA_BLOCK_ENCODING.toLowerCase();
|
||||
HColumnDescriptor.DATA_BLOCK_ENCODING.toLowerCase(Locale.ROOT);
|
||||
|
||||
public static final String OPT_INMEMORY = "in_memory";
|
||||
public static final String OPT_USAGE_IN_MEMORY = "Tries to keep the HFiles of the CF " +
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.apache.hadoop.hbase.thrift;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
@ -79,7 +80,7 @@ public class HThreadedSelectorServerArgs extends TThreadedSelectorServer.Args {
|
|||
int acceptQueueSizePerThread = conf.getInt(
|
||||
ACCEPT_QUEUE_SIZE_PER_THREAD_CONF_KEY, getAcceptQueueSizePerThread());
|
||||
AcceptPolicy acceptPolicy = AcceptPolicy.valueOf(conf.get(
|
||||
ACCEPT_POLICY_CONF_KEY, getAcceptPolicy().toString()).toUpperCase());
|
||||
ACCEPT_POLICY_CONF_KEY, getAcceptPolicy().toString()).toUpperCase(Locale.ROOT));
|
||||
|
||||
super.selectorThreads(selectorThreads)
|
||||
.workerThreads(workerThreads)
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.util.Bytes.getBytes;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
|
@ -59,7 +60,7 @@ public class ThriftUtilities {
|
|||
static public HColumnDescriptor colDescFromThrift(ColumnDescriptor in)
|
||||
throws IllegalArgument {
|
||||
Compression.Algorithm comp =
|
||||
Compression.getCompressionAlgorithmByName(in.compression.toLowerCase());
|
||||
Compression.getCompressionAlgorithmByName(in.compression.toLowerCase(Locale.ROOT));
|
||||
BloomType bt =
|
||||
BloomType.valueOf(in.bloomFilterType);
|
||||
|
||||
|
|
Loading…
Reference in New Issue