You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/02/04 18:54:35 UTC
[06/48] ACCUMULO-2292 Massive amount of fixes for findbugs warnings.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java b/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
index b44788c..76f1826 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
@@ -28,6 +28,7 @@ import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.SessionHandler;
public class EmbeddedWebServer {
+ private static String EMPTY = "";
Server server = null;
SocketConnector sock;
@@ -44,10 +45,10 @@ public class EmbeddedWebServer {
handler = new ContextHandlerCollection();
root = new Context(handler, "/", new SessionHandler(), null, null, null);
- if (Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTORE) == ""
- || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTOREPASS) == ""
- || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTORE) == ""
- || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTOREPASS) == "") {
+ if (EMPTY.equals(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTORE))
+ || EMPTY.equals(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTOREPASS))
+ || EMPTY.equals(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTORE))
+ || EMPTY.equals(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTOREPASS))) {
sock = new SocketConnector();
usingSsl = false;
} else {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/Info.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Info.java b/server/src/main/java/org/apache/accumulo/server/util/Info.java
index 4f03d82..7a07107 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Info.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Info.java
@@ -26,7 +26,7 @@ public class Info {
public static void main(String[] args) throws Exception {
ZooReaderWriter zrw = ZooReaderWriter.getInstance();
Instance instance = HdfsZooInstance.getInstance();
- System.out.println("monitor: " + new String(zrw.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, null)));
+ System.out.println("monitor: " + new String(zrw.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, null), Constants.UTF8));
System.out.println("masters: " + instance.getMasterLocations());
System.out.println("zookeepers: " + instance.getZooKeepers());
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
index 7802970..baa5400 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
@@ -313,7 +313,7 @@ public class Initialize {
// root's directory
Key rootDirKey = new Key(rootExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(), Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
- mfw.append(rootDirKey, new Value("/root_tablet".getBytes()));
+ mfw.append(rootDirKey, new Value("/root_tablet".getBytes(Constants.UTF8)));
// root's prev row
Key rootPrevRowKey = new Key(rootExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(), Constants.METADATA_PREV_ROW_COLUMN.getColumnQualifier(), 0);
@@ -324,11 +324,11 @@ public class Initialize {
// table tablet's directory
Key tableDirKey = new Key(tableExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(), Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
- mfw.append(tableDirKey, new Value(Constants.TABLE_TABLET_LOCATION.getBytes()));
+ mfw.append(tableDirKey, new Value(Constants.TABLE_TABLET_LOCATION.getBytes(Constants.UTF8)));
// table tablet time
Key tableTimeKey = new Key(tableExtent, Constants.METADATA_TIME_COLUMN.getColumnFamily(), Constants.METADATA_TIME_COLUMN.getColumnQualifier(), 0);
- mfw.append(tableTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes()));
+ mfw.append(tableTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(Constants.UTF8)));
// table tablet's prevrow
Key tablePrevRowKey = new Key(tableExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(), Constants.METADATA_PREV_ROW_COLUMN.getColumnQualifier(),
@@ -341,11 +341,11 @@ public class Initialize {
// default's directory
Key defaultDirKey = new Key(defaultExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(),
Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
- mfw.append(defaultDirKey, new Value(Constants.DEFAULT_TABLET_LOCATION.getBytes()));
+ mfw.append(defaultDirKey, new Value(Constants.DEFAULT_TABLET_LOCATION.getBytes(Constants.UTF8)));
// default's time
Key defaultTimeKey = new Key(defaultExtent, Constants.METADATA_TIME_COLUMN.getColumnFamily(), Constants.METADATA_TIME_COLUMN.getColumnQualifier(), 0);
- mfw.append(defaultTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes()));
+ mfw.append(defaultTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(Constants.UTF8)));
// default's prevrow
Key defaultPrevRowKey = new Key(defaultExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(),
@@ -393,28 +393,30 @@ public class Initialize {
// setup instance name
if (opts.clearInstanceName)
zoo.recursiveDelete(instanceNamePath, NodeMissingPolicy.SKIP);
- zoo.putPersistentData(instanceNamePath, uuid.getBytes(), NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(instanceNamePath, uuid.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
+ final byte[] EMPTY_BYTE_ARRAY = new byte[0], ZERO_CHAR_ARRAY = new byte[] {'0'};
+
// setup the instance
String zkInstanceRoot = Constants.ZROOT + "/" + uuid;
zoo.putPersistentData(zkInstanceRoot, new byte[0], NodeExistsPolicy.FAIL);
zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES, Constants.ZTABLES_INITIAL_ID, NodeExistsPolicy.FAIL);
TableManager.prepareNewTableState(uuid, Constants.METADATA_TABLE_ID, Constants.METADATA_TABLE_NAME, TableState.ONLINE, NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZTSERVERS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZPROBLEMS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZROOT_TABLET, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZROOT_TABLET_WALOGS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZTRACERS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTERS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_LOCK, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_GOAL_STATE, MasterGoalState.NORMAL.toString().getBytes(), NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZGC, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZGC_LOCK, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZCONFIG, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLE_LOCKS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZHDFS_RESERVATIONS, new byte[0], NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZNEXT_FILE, new byte[] {'0'}, NodeExistsPolicy.FAIL);
- zoo.putPersistentData(zkInstanceRoot + Constants.ZRECOVERY, new byte[] {'0'}, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZTSERVERS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZPROBLEMS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZROOT_TABLET, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZROOT_TABLET_WALOGS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZTRACERS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTERS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_LOCK, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_GOAL_STATE, MasterGoalState.NORMAL.toString().getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZGC, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZGC_LOCK, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZCONFIG, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLE_LOCKS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZHDFS_RESERVATIONS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZNEXT_FILE, ZERO_CHAR_ARRAY, NodeExistsPolicy.FAIL);
+ zoo.putPersistentData(zkInstanceRoot + Constants.ZRECOVERY, ZERO_CHAR_ARRAY, NodeExistsPolicy.FAIL);
}
private static String getInstanceNamePath(Opts opts) throws IOException, KeeperException, InterruptedException {
@@ -451,7 +453,7 @@ public class Initialize {
private static byte[] getRootPassword(Opts opts) throws IOException {
if (opts.cliPassword != null) {
- return opts.cliPassword.getBytes();
+ return opts.cliPassword.getBytes(Constants.UTF8);
}
String rootpass;
String confirmpass;
@@ -466,7 +468,7 @@ public class Initialize {
if (!rootpass.equals(confirmpass))
log.error("Passwords do not match");
} while (!rootpass.equals(confirmpass));
- return rootpass.getBytes();
+ return rootpass.getBytes(Constants.UTF8);
}
private static void initSecurity(Opts opts, String iid) throws AccumuloSecurityException, ThriftSecurityException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java b/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
index daab268..d2a56c5 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
@@ -146,7 +146,7 @@ public class ListInstances {
if (master == null) {
return null;
}
- return new String(master);
+ return new String(master, Constants.UTF8);
} catch (Exception e) {
handleException(e);
return null;
@@ -171,7 +171,7 @@ public class ListInstances {
for (String name : names) {
String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name;
try {
- UUID iid = UUID.fromString(new String(zk.getData(instanceNamePath, null)));
+ UUID iid = UUID.fromString(new String(zk.getData(instanceNamePath, null), Constants.UTF8));
tm.put(name, iid);
} catch (Exception e) {
handleException(e);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java b/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
index cfc159f..4be9101 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
@@ -62,12 +62,14 @@ public class LocalityCheck {
addBlocks(fs, host, files, totalBlocks, localBlocks);
files.clear();
} else if (key.compareColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY) == 0) {
- files.add(new String(KeyExtent.tableOfMetadataRow(key.getRow())) + slash(key.getColumnQualifier().toString()));
+ files.add(new String(KeyExtent.tableOfMetadataRow(key.getRow()), Constants.UTF8) + slash(key.getColumnQualifier().toString()));
}
}
System.out.println(" Server %local total blocks");
- for (String host : totalBlocks.keySet()) {
- System.out.println(String.format("%15s %5.1f %8d", host, (localBlocks.get(host) * 100.) / totalBlocks.get(host), totalBlocks.get(host)));
+ for (Entry<String,Long> entry : totalBlocks.entrySet()) {
+ final String host = entry.getKey();
+ final Long blocksForHost = entry.getValue();
+ System.out.println(String.format("%15s %5.1f %8d", host, (localBlocks.get(host) * 100.) / blocksForHost, blocksForHost));
}
return 0;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java b/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
index 935671b..7328a55 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
@@ -109,7 +109,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
}
public static void putLockID(ZooLock zooLock, Mutation m) {
- Constants.METADATA_LOCK_COLUMN.put(m, new Value(zooLock.getLockID().serialize(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/").getBytes()));
+ Constants.METADATA_LOCK_COLUMN.put(m, new Value(zooLock.getLockID().serialize(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/").getBytes(Constants.UTF8)));
}
public static void update(TCredentials credentials, Mutation m) {
@@ -188,7 +188,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
if (dfv.getNumEntries() > 0) {
m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(dfv.encode()));
- Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+ Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(Constants.UTF8)));
// stuff in this location
TServerInstance self = getTServerInstance(address, zooLock);
self.putLastLocation(m);
@@ -203,12 +203,12 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
}
for (String scanFile : filesInUseByScans)
- m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes()));
+ m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value(new byte[0]));
if (mergeFile != null)
m.putDelete(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(mergeFile));
- Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushId + "").getBytes()));
+ Constants.METADATA_FLUSH_COLUMN.put(m, new Value(Long.toString(flushId).getBytes(Constants.UTF8)));
update(credentials, zooLock, m);
@@ -230,7 +230,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
public static void updateTabletFlushID(KeyExtent extent, long flushID, TCredentials credentials, ZooLock zooLock) {
if (!extent.isRootTablet()) {
Mutation m = new Mutation(extent.getMetadataEntry());
- Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushID + "").getBytes()));
+ Constants.METADATA_FLUSH_COLUMN.put(m, new Value(Long.toString(flushID).getBytes(Constants.UTF8)));
update(credentials, zooLock, m);
}
}
@@ -238,29 +238,29 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
public static void updateTabletCompactID(KeyExtent extent, long compactID, TCredentials credentials, ZooLock zooLock) {
if (!extent.isRootTablet()) {
Mutation m = new Mutation(extent.getMetadataEntry());
- Constants.METADATA_COMPACT_COLUMN.put(m, new Value((compactID + "").getBytes()));
+ Constants.METADATA_COMPACT_COLUMN.put(m, new Value(Long.toString(compactID).getBytes(Constants.UTF8)));
update(credentials, zooLock, m);
}
}
public static void updateTabletDataFile(long tid, KeyExtent extent, Map<String,DataFileValue> estSizes, String time, TCredentials credentials, ZooLock zooLock) {
Mutation m = new Mutation(extent.getMetadataEntry());
- byte[] tidBytes = Long.toString(tid).getBytes();
+ byte[] tidBytes = Long.toString(tid).getBytes(Constants.UTF8);
for (Entry<String,DataFileValue> entry : estSizes.entrySet()) {
Text file = new Text(entry.getKey());
m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, file, new Value(entry.getValue().encode()));
m.put(Constants.METADATA_BULKFILE_COLUMN_FAMILY, file, new Value(tidBytes));
}
- Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+ Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(Constants.UTF8)));
update(credentials, zooLock, m);
}
public static void addTablet(KeyExtent extent, String path, TCredentials credentials, char timeType, ZooLock lock) {
Mutation m = extent.getPrevRowUpdateMutation();
- Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes()));
- Constants.METADATA_TIME_COLUMN.put(m, new Value((timeType + "0").getBytes()));
+ Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes(Constants.UTF8)));
+ Constants.METADATA_TIME_COLUMN.put(m, new Value((timeType + "0").getBytes(Constants.UTF8)));
update(credentials, lock, m);
}
@@ -325,7 +325,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
try {
log.info("trying to write root tablet location to ZooKeeper as " + address);
String zRootLocPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZROOT_TABLET_LOCATION;
- zoo.putPersistentData(zRootLocPath, address.getBytes(), NodeExistsPolicy.OVERWRITE);
+ zoo.putPersistentData(zRootLocPath, address.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
return true;
} catch (Exception e) {
log.error("Master: unable to save root tablet location in zookeeper. exception: " + e, e);
@@ -361,12 +361,12 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
Map<String,Long> bulkLoadedFiles, TCredentials credentials, String time, long lastFlushID, long lastCompactID, ZooLock zooLock) {
Mutation m = extent.getPrevRowUpdateMutation();
- Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes()));
- Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+ Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes(Constants.UTF8)));
+ Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(Constants.UTF8)));
if (lastFlushID > 0)
- Constants.METADATA_FLUSH_COLUMN.put(m, new Value(("" + lastFlushID).getBytes()));
+ Constants.METADATA_FLUSH_COLUMN.put(m, new Value(Long.toString(lastFlushID).getBytes(Constants.UTF8)));
if (lastCompactID > 0)
- Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + lastCompactID).getBytes()));
+ Constants.METADATA_COMPACT_COLUMN.put(m, new Value(Long.toString(lastCompactID).getBytes(Constants.UTF8)));
if (location != null) {
m.put(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, location.asColumnQualifier(), location.asMutationValue());
@@ -378,7 +378,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
}
for (Entry<String,Long> entry : bulkLoadedFiles.entrySet()) {
- byte[] tidBytes = Long.toString(entry.getValue()).getBytes();
+ byte[] tidBytes = Long.toString(entry.getValue()).getBytes(Constants.UTF8);
m.put(Constants.METADATA_BULKFILE_COLUMN_FAMILY, new Text(entry.getKey()), new Value(tidBytes));
}
@@ -396,7 +396,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
public static void splitTablet(KeyExtent extent, Text oldPrevEndRow, double splitRatio, TCredentials credentials, ZooLock zooLock) {
Mutation m = extent.getPrevRowUpdateMutation(); //
- Constants.METADATA_SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(splitRatio).getBytes()));
+ Constants.METADATA_SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(splitRatio).getBytes(Constants.UTF8)));
Constants.METADATA_OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(oldPrevEndRow));
Constants.METADATA_CHOPPED_COLUMN.putDelete(m);
@@ -446,13 +446,13 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
m.putDelete(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(pathToRemove));
for (String scanFile : scanFiles)
- m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes()));
+ m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value(new byte[0]));
if (size.getNumEntries() > 0)
m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(size.encode()));
if (compactionId != null)
- Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + compactionId).getBytes()));
+ Constants.METADATA_COMPACT_COLUMN.put(m, new Value(Long.toString(compactionId).getBytes(Constants.UTF8)));
TServerInstance self = getTServerInstance(address, zooLock);
self.putLastLocation(m);
@@ -602,7 +602,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
throw new IllegalArgumentException("Metadata entry does not have split ratio (" + metadataEntry + ")");
}
- double splitRatio = Double.parseDouble(new String(columns.get(Constants.METADATA_SPLIT_RATIO_COLUMN).get()));
+ double splitRatio = Double.parseDouble(new String(columns.get(Constants.METADATA_SPLIT_RATIO_COLUMN).get(), Constants.UTF8));
Value prevEndRowIBW = columns.get(Constants.METADATA_PREV_ROW_COLUMN);
@@ -767,7 +767,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
} else {
String value = StringUtil.join(entry.logSet, ";") + "|" + entry.tabletId;
Mutation m = new Mutation(entry.extent.getMetadataEntry());
- m.put(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename), new Value(value.getBytes()));
+ m.put(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename), new Value(value.getBytes(Constants.UTF8)));
update(credentials, zooLock, m);
}
}
@@ -1093,7 +1093,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
} else {
// write out marker that this tablet was successfully cloned
Mutation m = new Mutation(cloneTablet.keySet().iterator().next().getRow());
- m.put(Constants.METADATA_CLONED_COLUMN_FAMILY, new Text(""), new Value("OK".getBytes()));
+ m.put(Constants.METADATA_CLONED_COLUMN_FAMILY, new Text(""), new Value("OK".getBytes(Constants.UTF8)));
bw.addMutation(m);
}
}
@@ -1148,7 +1148,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
Key k = entry.getKey();
Mutation m = new Mutation(k.getRow());
m.putDelete(k.getColumnFamily(), k.getColumnQualifier());
- Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes())));
+ Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes(Constants.UTF8))));
bw.addMutation(m);
}
@@ -1158,7 +1158,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
public static void chopped(KeyExtent extent, ZooLock zooLock) {
Mutation m = new Mutation(extent.getMetadataEntry());
- Constants.METADATA_CHOPPED_COLUMN.put(m, new Value("chopped".getBytes()));
+ Constants.METADATA_CHOPPED_COLUMN.put(m, new Value("chopped".getBytes(Constants.UTF8)));
update(SecurityConstants.getSystemCredentials(), zooLock, m);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java b/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
index 88668fc..767be0a 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
@@ -68,7 +68,7 @@ public class RemoveEntriesForMissingFiles {
for (Entry<Key,Value> entry : metadata) {
count++;
Key key = entry.getKey();
- String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()));
+ String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()), Constants.UTF8);
String file = key.getColumnQualifier().toString();
if (!file.startsWith("/"))
file = "/" + file;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java b/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
index bad0d8b..8985b27 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
@@ -23,6 +23,7 @@ import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -78,9 +79,9 @@ public class RestoreZookeeper {
}
private void create(String path, String value, String encoding) {
- byte[] data = value.getBytes();
+ byte[] data = value.getBytes(Constants.UTF8);
if ("base64".equals(encoding))
- data = Base64.decodeBase64(value.getBytes());
+ data = Base64.decodeBase64(data);
try {
try {
zk.putPersistentData(path, data, overwrite ? NodeExistsPolicy.OVERWRITE : NodeExistsPolicy.FAIL);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java b/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
index 5e52ede..bf45c30 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
@@ -18,10 +18,12 @@ package org.apache.accumulo.server.util;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.net.URLEncoder;
@@ -35,6 +37,7 @@ import java.util.regex.Pattern;
import javax.net.SocketFactory;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.Help;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.commons.lang.math.LongRange;
@@ -114,19 +117,19 @@ public class SendLogToChainsaw extends XMLLayout {
public void processLogFiles() throws IOException {
String line = null;
String out = null;
- FileReader fReader = null;
+ InputStreamReader isReader = null;
BufferedReader reader = null;
try {
for (File log : logFiles) {
// Parse the server type and name from the log file name
String threadName = log.getName().substring(0, log.getName().indexOf("."));
try {
- fReader = new FileReader(log);
+ isReader = new InputStreamReader(new FileInputStream(log), Constants.UTF8);
} catch (FileNotFoundException e) {
System.out.println("Unable to find file: " + log.getAbsolutePath());
throw e;
}
- reader = new BufferedReader(fReader);
+ reader = new BufferedReader(isReader);
try {
line = reader.readLine();
@@ -134,7 +137,7 @@ public class SendLogToChainsaw extends XMLLayout {
out = convertLine(line, threadName);
if (null != out) {
if (socket != null && socket.isConnected())
- socket.getOutputStream().write(out.getBytes());
+ socket.getOutputStream().write(out.getBytes(Constants.UTF8));
else
System.err.println("Unable to send data to transport");
}
@@ -147,8 +150,8 @@ public class SendLogToChainsaw extends XMLLayout {
if (reader != null) {
reader.close();
}
- if (fReader != null) {
- fReader.close();
+ if (isReader != null) {
+ isReader.close();
}
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java b/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java
index affe12f..b6ca527 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java
@@ -33,7 +33,7 @@ public class SystemPropUtil {
// create the zk node for this property and set it's data to the specified value
String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property;
- ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(), NodeExistsPolicy.OVERWRITE);
+ ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
return true;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java b/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java
index cdee8fb..bcaf9b0 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java
@@ -36,7 +36,7 @@ public class TablePropUtil {
// create the zk node for this property and set it's data to the specified value
String zPath = zkTablePath + "/" + property;
- ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(), NodeExistsPolicy.OVERWRITE);
+ ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
return true;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java b/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
index dfb05d0..2fc0bd3 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
@@ -59,7 +59,7 @@ public class TabletServerLocks {
byte[] lockData = ZooLock.getLockData(cache, tserverPath + "/" + tabletServer, null);
String holder = null;
if (lockData != null) {
- holder = new String(lockData);
+ holder = new String(lockData, Constants.UTF8);
}
System.out.printf("%32s %16s%n", tabletServer, holder);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java b/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
index 66e68c3..b842e09 100644
--- a/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
+++ b/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
@@ -219,7 +219,7 @@ public class DistributedWorkQueue {
public void waitUntilDone(Set<String> workIDs) throws KeeperException, InterruptedException {
- final String condVar = new String("cond");
+ final String condVar = "cond";
Watcher watcher = new Watcher() {
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
index 93a0460..f7c1e68 100644
--- a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
+++ b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.zookeeper;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.fate.zookeeper.DistributedReadWriteLock;
import org.apache.zookeeper.KeeperException;
@@ -30,8 +31,8 @@ public class ZooQueueLock extends org.apache.accumulo.fate.zookeeper.ZooQueueLoc
public static void main(String args[]) throws InterruptedException, KeeperException {
ZooQueueLock lock = new ZooQueueLock("/lock", true);
- DistributedReadWriteLock rlocker = new DistributedReadWriteLock(lock, "reader".getBytes());
- DistributedReadWriteLock wlocker = new DistributedReadWriteLock(lock, "wlocker".getBytes());
+ DistributedReadWriteLock rlocker = new DistributedReadWriteLock(lock, "reader".getBytes(Constants.UTF8));
+ DistributedReadWriteLock wlocker = new DistributedReadWriteLock(lock, "wlocker".getBytes(Constants.UTF8));
final Lock readLock = rlocker.readLock();
readLock.lock();
final Lock readLock2 = rlocker.readLock();
@@ -44,7 +45,7 @@ public class ZooQueueLock extends org.apache.accumulo.fate.zookeeper.ZooQueueLoc
writeLock.lock();
if (readLock.tryLock(100, TimeUnit.MILLISECONDS))
throw new RuntimeException("Read lock achieved during write lock!");
- final Lock writeLock2 = DistributedReadWriteLock.recoverLock(lock, "wlocker".getBytes());
+ final Lock writeLock2 = DistributedReadWriteLock.recoverLock(lock, "wlocker".getBytes(Constants.UTF8));
writeLock2.unlock();
readLock.lock();
System.out.println("success");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
index 70ba661..f950077 100644
--- a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
+++ b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
@@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.fate.util.UtilWaitThread;
@@ -36,7 +37,7 @@ public class ZooReaderWriter extends org.apache.accumulo.fate.zookeeper.ZooReade
private static IZooReaderWriter retryingInstance = null;
public ZooReaderWriter(String string, int timeInMillis, String secret) {
- super(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes());
+ super(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes(Constants.UTF8));
}
public static synchronized ZooReaderWriter getInstance() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
index 8cfbdcc..5f7fd5e 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
@@ -240,10 +240,8 @@ public class AccumuloClassLoader {
if (c == null) {
try {
// try finding this class here instead of parent
- c = findClass(name);
- } catch (ClassNotFoundException e) {
-
- }
+ findClass(name);
+ } catch (ClassNotFoundException e) {}
}
}
return super.loadClass(name, resolve);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
index e4737ec..a6cc19a 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.start.classloader.vfs;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
public class FinalCloseDefaultFileSystemManager extends DefaultFileSystemManager {
- public void finalize() {
+ protected void finalize() {
close();
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java
index 723484c..0a6931f 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java
@@ -41,7 +41,7 @@ public class PostDelegatingVFSClassLoader extends VFSClassLoader {
if (c == null) {
try {
// try finding this class here instead of parent
- c = findClass(name);
+ findClass(name);
} catch (ClassNotFoundException e) {
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
index 76de726..aada2c7 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsRandomAccessContent.java
@@ -20,6 +20,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import org.apache.commons.vfs2.RandomAccessContent;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -153,7 +154,7 @@ public class HdfsRandomAccessContent implements RandomAccessContent {
*/
@Override
public String readLine() throws IOException {
- BufferedReader d = new BufferedReader(new InputStreamReader(this.fis));
+ BufferedReader d = new BufferedReader(new InputStreamReader(this.fis, Charset.forName("UTF-8")));
return d.readLine();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java b/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java
index 48cbde8..3807625 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java
@@ -20,12 +20,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.accumulo.server.cli.ClientOnRequiredTable;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.server.cli.ClientOnRequiredTable;
import org.apache.accumulo.server.client.HdfsZooInstance;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -49,7 +50,7 @@ public class BulkImportDirectory {
if (args.length == 5) {
System.err.println("Deprecated syntax for BulkImportDirectory, please use the new style (see --help)");
final String user = args[0];
- final byte[] pass = args[1].getBytes();
+ final byte[] pass = args[1].getBytes(Constants.UTF8);
final String tableName = args[2];
final String dir = args[3];
final String failureDir = args[4];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java b/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java
index 14c5cef..1723459 100644
--- a/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.test;
import java.util.Map.Entry;
import java.util.TreeSet;
-import org.apache.accumulo.server.cli.ClientOnDefaultTable;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.BatchWriter;
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.server.cli.ClientOnDefaultTable;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
@@ -78,7 +79,7 @@ public class CreateTestTable {
// populate
for (int i = 0; i < opts.count; i++) {
Mutation m = new Mutation(new Text(String.format("%05d", i)));
- m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes()));
+ m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes(Constants.UTF8)));
b.addMutation(m);
}
b.close();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java
index 79dc48d..acb5b67 100644
--- a/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.test;
import java.util.Iterator;
import java.util.Map.Entry;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -60,7 +61,7 @@ public class NativeMapConcurrencyTest {
for (int i = 0; i < numRows; i++) {
Mutation m = nm(i + start);
for (int j = 0; j < numCols; j++) {
- Value val = new Value("test".getBytes());
+ Value val = new Value("test".getBytes(Constants.UTF8));
pc(m, j, val);
}
nm.mutate(m, mc++);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java
index a63b777..73b73f4 100644
--- a/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java
@@ -18,12 +18,13 @@ package org.apache.accumulo.test;
import java.util.Collections;
import java.util.Iterator;
+import java.util.Map.Entry;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListMap;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -76,7 +77,7 @@ public class NativeMapPerformanceTest {
Mutation m = nm(row);
for (int j = 0; j < numCols; j++) {
int col = rand.nextInt(1000000);
- Value val = new Value("test".getBytes());
+ Value val = new Value("test".getBytes(Constants.UTF8));
pc(m, col, val);
}
nm.mutate(m, i);
@@ -87,7 +88,7 @@ public class NativeMapPerformanceTest {
for (int j = 0; j < numCols; j++) {
int col = rand.nextInt(1000000);
Key key = nk(row, col);
- Value val = new Value("test".getBytes());
+ Value val = new Value("test".getBytes(Constants.UTF8));
tm.put(key, val);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java
index 2d0bd45..8411c86 100644
--- a/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java
@@ -20,10 +20,11 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
-import java.util.Map.Entry;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -49,7 +50,7 @@ public class NativeMapStressTest {
private static void put(NativeMap nm, String row, String val, int mc) {
Mutation m = new Mutation(new Text(row));
- m.put(new Text(), new Text(), Long.MAX_VALUE, new Value(val.getBytes()));
+ m.put(new Text(), new Text(), Long.MAX_VALUE, new Value(val.getBytes(Constants.UTF8)));
nm.mutate(m, mc);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
index 0e2735f..f48b8cf 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
@@ -21,6 +21,7 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.TreeSet;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.BatchWriter;
@@ -88,6 +89,9 @@ public class TestBinaryRows {
try {
Connector connector = opts.getConnector();
+ final Text CF = new Text("cf"), CQ = new Text("cq");
+ final byte[] CF_BYTES = "cf".getBytes(Constants.UTF8), CQ_BYTES = "cq".getBytes(Constants.UTF8);
+
if (opts.mode.equals("ingest") || opts.mode.equals("delete")) {
BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
boolean delete = opts.mode.equals("delete");
@@ -98,9 +102,9 @@ public class TestBinaryRows {
Mutation m = new Mutation(new Text(row));
if (delete) {
- m.putDelete(new Text("cf"), new Text("cq"));
+ m.putDelete(CF, CQ);
} else {
- m.put(new Text("cf"), new Text("cq"), new Value(value.getBytes()));
+ m.put(CF, CQ, new Value(value.getBytes(Constants.UTF8)));
}
bw.addMutation(m);
}
@@ -109,8 +113,8 @@ public class TestBinaryRows {
} else if (opts.mode.equals("verifyDeleted")) {
Scanner s = connector.createScanner(opts.tableName, opts.auths);
s.setBatchSize(scanOpts.scanBatchSize);
- Key startKey = new Key(encodeLong(opts.start), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE);
- Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), "cf".getBytes(), "cq".getBytes(), new byte[0], 0);
+ Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+ Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setBatchSize(50000);
s.setRange(new Range(startKey, stopKey));
@@ -124,8 +128,8 @@ public class TestBinaryRows {
long t1 = System.currentTimeMillis();
Scanner s = connector.createScanner(opts.tableName, opts.auths);
- Key startKey = new Key(encodeLong(opts.start), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE);
- Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), "cf".getBytes(), "cq".getBytes(), new byte[0], 0);
+ Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+ Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setBatchSize(scanOpts.scanBatchSize);
s.setRange(new Range(startKey, stopKey));
@@ -166,8 +170,8 @@ public class TestBinaryRows {
Scanner s = connector.createScanner(opts.tableName, opts.auths);
s.setBatchSize(scanOpts.scanBatchSize);
- Key startKey = new Key(encodeLong(row), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE);
- Key stopKey = new Key(encodeLong(row), "cf".getBytes(), "cq".getBytes(), new byte[0], 0);
+ Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+ Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setRange(new Range(startKey, stopKey));
Iterator<Entry<Key,Value>> si = s.iterator();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/TestIngest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TestIngest.java b/test/src/main/java/org/apache/accumulo/test/TestIngest.java
index 73fa400..33c3b0c 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestIngest.java
@@ -21,6 +21,7 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.Connector;
@@ -150,8 +151,8 @@ public class TestIngest {
return bytevals;
}
- private static byte ROW_PREFIX[] = "row_".getBytes();
- private static byte COL_PREFIX[] = "col_".getBytes();
+ private static byte ROW_PREFIX[] = "row_".getBytes(Constants.UTF8);
+ private static byte COL_PREFIX[] = "col_".getBytes(Constants.UTF8);
public static Text generateRow(int rowid, int startRow) {
return new Text(FastFormat.toZeroPaddedString(rowid + startRow, 10, 10, ROW_PREFIX));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
index a65e01b..46174b5 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.test;
import java.util.ArrayList;
import java.util.Map.Entry;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.AccumuloException;
@@ -96,7 +97,7 @@ public class TestMultiTableIngest {
// populate
for (int i = 0; i < opts.count; i++) {
Mutation m = new Mutation(new Text(String.format("%05d", i)));
- m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes()));
+ m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes(Constants.UTF8)));
b.getBatchWriter(tableNames.get(i % tableNames.size())).addMutation(m);
}
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
index 935c3a7..fe30965 100644
--- a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Random;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
@@ -186,7 +187,7 @@ public class VerifyIngest {
if (entry.getValue().compareTo(value) != 0) {
log.error("unexpected value, rowNum : " + rowNum + " colNum : " + colNum);
- log.error(" saw = " + new String(entry.getValue().get()) + " expected = " + new String(value));
+ log.error(" saw = " + new String(entry.getValue().get()) + " expected = " + new String(value, Constants.UTF8));
errors++;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java
index ac8d30c..23cf15d 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java
@@ -120,7 +120,7 @@ public class ContinuousIngest {
visibilities = new ArrayList<ColumnVisibility>();
FileSystem fs = FileSystem.get(new Configuration());
- BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(opts.visFile))));
+ BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(opts.visFile)), Constants.UTF8));
String line;
@@ -158,9 +158,9 @@ public class ContinuousIngest {
Random r = new Random();
- byte[] ingestInstanceId = UUID.randomUUID().toString().getBytes();
+ byte[] ingestInstanceId = UUID.randomUUID().toString().getBytes(Constants.UTF8);
- System.out.printf("UUID %d %s%n", System.currentTimeMillis(), new String(ingestInstanceId));
+ System.out.printf("UUID %d %s%n", System.currentTimeMillis(), new String(ingestInstanceId, Constants.UTF8));
long count = 0;
final int flushInterval = 1000000;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java
index 585dc90..bbe7fa3 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java
@@ -21,6 +21,7 @@ import java.util.Random;
import java.util.Set;
import java.util.UUID;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
@@ -86,7 +87,7 @@ public class ContinuousMoru extends Configured implements Tool {
random = new Random();
ingestInstanceId = context.getConfiguration().get(CI_ID);
- iiId = ingestInstanceId.getBytes();
+ iiId = ingestInstanceId.getBytes(Constants.UTF8);
count = 0;
}
@@ -102,7 +103,7 @@ public class ContinuousMoru extends Configured implements Tool {
int offset = ContinuousWalk.getPrevRowOffset(val);
if (offset > 0) {
- long rowLong = Long.parseLong(new String(val, offset, 16), 16);
+ long rowLong = Long.parseLong(new String(val, offset, 16, Constants.UTF8), 16);
Mutation m = ContinuousIngest.genMutation(rowLong, random.nextInt(max_cf), random.nextInt(max_cq), EMPTY_VIS, iiId, count++, key.getRowData()
.toArray(), random, true);
context.write(null, m);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java
index 7bb5663..117c136 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.test.continuous;
import java.util.Map.Entry;
import java.util.Random;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
@@ -61,7 +62,7 @@ public class ContinuousQuery {
}
long t2 = System.currentTimeMillis();
- System.out.printf("SRQ %d %s %d %d%n", t1, new String(row), (t2 - t1), count);
+ System.out.printf("SRQ %d %s %d %d%n", t1, new String(row, Constants.UTF8), (t2 - t1), count);
if (opts.sleepTime > 0)
Thread.sleep(opts.sleepTime);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java
index 00e4b36..c331bab 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java
@@ -20,6 +20,7 @@ import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Random;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
@@ -93,7 +94,7 @@ public class ContinuousScanner {
// System.out.println("P2 "+delta +" "+numToScan+" "+distance+" "+((double)numToScan/count ));
}
- System.out.printf("SCN %d %s %d %d%n", t1, new String(scanStart), (t2 - t1), count);
+ System.out.printf("SCN %d %s %d %d%n", t1, new String(scanStart, Constants.UTF8), (t2 - t1), count);
if (opts.sleepTime > 0)
UtilWaitThread.sleep(opts.sleepTime);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
index e0c2fe5..a5a6a2b 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
@@ -24,6 +24,7 @@ import java.util.HashSet;
import java.util.Random;
import java.util.Set;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ClientOnDefaultTable;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
@@ -108,7 +109,7 @@ public class ContinuousVerify extends Configured implements Tool {
int offset = ContinuousWalk.getPrevRowOffset(val);
if (offset > 0) {
- ref.set(Long.parseLong(new String(val, offset, 16), 16));
+ ref.set(Long.parseLong(new String(val, offset, 16, Constants.UTF8), 16));
vrow.set(r);
context.write(ref, vrow);
}
@@ -142,7 +143,7 @@ public class ContinuousVerify extends Configured implements Tool {
for (Long ref : refs) {
sb.append(comma);
comma = ",";
- sb.append(new String(ContinuousIngest.genRow(ref)));
+ sb.append(new String(ContinuousIngest.genRow(ref), Constants.UTF8));
}
context.write(new Text(ContinuousIngest.genRow(key.get())), new Text(sb.toString()));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java
index 469eabf..4032dfa 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java
@@ -86,7 +86,7 @@ public class ContinuousWalk {
auths = new ArrayList<Authorizations>();
FileSystem fs = FileSystem.get(new Configuration());
- BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(file))));
+ BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(file)), Constants.UTF8));
try {
String line;
while ((line = in.readLine()) != null) {
@@ -173,7 +173,7 @@ public class ContinuousWalk {
long t2 = System.currentTimeMillis();
- System.out.printf("FSR %d %s %d %d%n", t1, new String(scanStart), (t2 - t1), count);
+ System.out.printf("FSR %d %s %d %d%n", t1, new String(scanStart, Constants.UTF8), (t2 - t1), count);
return pr;
}
@@ -182,12 +182,12 @@ public class ContinuousWalk {
if (val.length == 0)
throw new IllegalArgumentException();
if (val[53] != ':')
- throw new IllegalArgumentException(new String(val));
+ throw new IllegalArgumentException(new String(val, Constants.UTF8));
// prev row starts at 54
if (val[54] != ':') {
if (val[54 + 16] != ':')
- throw new IllegalArgumentException(new String(val));
+ throw new IllegalArgumentException(new String(val, Constants.UTF8));
return 54;
}
@@ -199,7 +199,7 @@ public class ContinuousWalk {
byte[] val = value.get();
int offset = getPrevRowOffset(val);
if (offset > 0) {
- return new String(val, offset, 16);
+ return new String(val, offset, 16, Constants.UTF8);
}
return null;
@@ -208,7 +208,7 @@ public class ContinuousWalk {
static int getChecksumOffset(byte val[]) {
if (val[val.length - 1] != ':') {
if (val[val.length - 9] != ':')
- throw new IllegalArgumentException(new String(val));
+ throw new IllegalArgumentException(new String(val, Constants.UTF8));
return val.length - 8;
}
@@ -220,7 +220,7 @@ public class ContinuousWalk {
if (ckOff < 0)
return;
- long storedCksum = Long.parseLong(new String(value.get(), ckOff, 8), 16);
+ long storedCksum = Long.parseLong(new String(value.get(), ckOff, 8, Constants.UTF8), 16);
CRC32 cksum = new CRC32();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
index 1f36026..f1657b7 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
@@ -30,6 +30,8 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+import org.apache.accumulo.core.Constants;
+
class HistData<T> implements Comparable<HistData<T>>, Serializable {
private static final long serialVersionUID = 1L;
@@ -147,7 +149,7 @@ public class Histogram<T> implements Serializable {
FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
- PrintStream ps = new PrintStream(bos);
+ PrintStream ps = new PrintStream(bos, false, Constants.UTF8.name());
TreeSet<HistData<T>> sortedCounts = new TreeSet<HistData<T>>(counts.values());
for (Iterator<HistData<T>> iter = sortedCounts.iterator(); iter.hasNext();) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
index 896c23a..fc5262b 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
@@ -22,6 +22,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.apache.accumulo.core.Constants;
+
public class PrintScanTimeHistogram {
public static void main(String[] args) throws Exception {
@@ -43,7 +45,7 @@ public class PrintScanTimeHistogram {
private static void processFile(InputStream ins, Histogram<String> srqHist, Histogram<String> fsrHist) throws FileNotFoundException, IOException {
String line;
- BufferedReader in = new BufferedReader(new InputStreamReader(ins));
+ BufferedReader in = new BufferedReader(new InputStreamReader(ins, Constants.UTF8));
while ((line = in.readLine()) != null) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
index 286fd5e..2f22f36 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
@@ -25,6 +25,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ClientOpts.TimeConverter;
import org.apache.accumulo.core.cli.Help;
@@ -71,7 +72,7 @@ public class TimeBinner {
Operation operation = Operation.valueOf(opts.operation);
SimpleDateFormat sdf = new SimpleDateFormat(opts.dateFormat);
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in, Constants.UTF8));
String line = null;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java
index 1c60640..d424175 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.test.continuous;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.InputStreamReader;
@@ -34,7 +35,7 @@ import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
-import org.apache.accumulo.server.cli.ClientOnDefaultTable;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchScannerOpts;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.Connector;
@@ -42,6 +43,7 @@ import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.server.cli.ClientOnDefaultTable;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
@@ -82,7 +84,7 @@ public class UndefinedAnalyzer {
}
private void parseLog(File log) throws Exception {
- BufferedReader reader = new BufferedReader(new FileReader(log));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(log), Constants.UTF8));
String line;
TreeMap<Long,Long> tm = null;
try {
@@ -143,10 +145,10 @@ public class UndefinedAnalyzer {
long time;
TabletAssignment(String tablet, String er, String per, String server, long time) {
- this.tablet = new String(tablet);
- this.endRow = new String(er);
- this.prevEndRow = new String(per);
- this.server = new String(server);
+ this.tablet = tablet;
+ this.endRow = er;
+ this.prevEndRow = per;
+ this.server = server;
this.time = time;
}
@@ -173,7 +175,7 @@ public class UndefinedAnalyzer {
for (File masterLog : masterLogs) {
- BufferedReader reader = new BufferedReader(new FileReader(masterLog));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(masterLog), Constants.UTF8));
String line;
try {
while ((line = reader.readLine()) != null) {
@@ -254,7 +256,7 @@ public class UndefinedAnalyzer {
List<UndefinedNode> undefs = new ArrayList<UndefinedNode>();
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, Constants.UTF8));
String line;
while ((line = reader.readLine()) != null) {
String[] tokens = line.split("\\s");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java
index 42435d8..8027754 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java
@@ -138,7 +138,7 @@ public class AddSplitTest extends FunctionalTest {
String row = String.format("%09d", i);
Mutation m = new Mutation(new Text(row));
- m.put(new Text("cf1"), new Text("cq1"), ts, new Value(("" + i).getBytes()));
+ m.put(new Text("cf1"), new Text("cq1"), ts, new Value(Integer.toString(i).getBytes(Constants.UTF8)));
bw.addMutation(m);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java
index da2403e..60400ea 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java
@@ -56,7 +56,7 @@ public class BadIteratorMincTest extends FunctionalTest {
BatchWriter bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
Mutation m = new Mutation(new Text("r1"));
- m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
+ m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes(Constants.UTF8)));
bw.addMutation(m);
@@ -101,7 +101,7 @@ public class BadIteratorMincTest extends FunctionalTest {
getConnector().tableOperations().setProperty("foo", Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.badi", "30," + BadIterator.class.getName());
bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
m = new Mutation(new Text("r2"));
- m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
+ m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes(Constants.UTF8)));
bw.addMutation(m);
bw.close();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java
index 41a532c..3ebfb51 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java
@@ -65,7 +65,7 @@ public class BatchScanSplitTest extends FunctionalTest {
for (int i = 0; i < numRows; i++) {
Mutation m = new Mutation(new Text(String.format("%09x", i)));
- m.put(new Text("cf1"), new Text("cq1"), new Value(String.format("%016x", numRows - i).getBytes()));
+ m.put(new Text("cf1"), new Text("cq1"), new Value(String.format("%016x", numRows - i).getBytes(Constants.UTF8)));
bw.addMutation(m);
}
@@ -89,7 +89,7 @@ public class BatchScanSplitTest extends FunctionalTest {
for (int i = 0; i < 100; i++) {
int r = random.nextInt(numRows);
Text row = new Text(String.format("%09x", r));
- expected.put(row, new Value(String.format("%016x", numRows - r).getBytes()));
+ expected.put(row, new Value(String.format("%016x", numRows - r).getBytes(Constants.UTF8)));
ranges.add(new Range(row));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java
index 25aaf94..d649864 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java
@@ -76,7 +76,7 @@ public class BatchWriterFlushTest extends FunctionalTest {
Scanner scanner = getConnector().createScanner("bwlt", Constants.NO_AUTHS);
Mutation m = new Mutation(new Text(String.format("r_%10d", 1)));
- m.put(new Text("cf"), new Text("cq"), new Value(("" + 1).getBytes()));
+ m.put(new Text("cf"), new Text("cq"), new Value("1".getBytes(Constants.UTF8)));
bw.addMutation(m);
UtilWaitThread.sleep(1000);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
index 6f57f8c..ffe0a48 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
@@ -70,7 +70,7 @@ public class BloomFilterTest extends FunctionalTest {
// test inserting an empty key
BatchWriter bw = getConnector().createBatchWriter("bt4", new BatchWriterConfig());
Mutation m = new Mutation(new Text(""));
- m.put(new Text(""), new Text(""), new Value("foo1".getBytes()));
+ m.put(new Text(""), new Text(""), new Value("foo1".getBytes(Constants.UTF8)));
bw.addMutation(m);
bw.close();
getConnector().tableOperations().flush("bt4", null, null, true);
@@ -207,15 +207,15 @@ public class BloomFilterTest extends FunctionalTest {
switch (depth) {
case 1:
m = new Mutation(new Text(key));
- m.put(new Text("cf"), new Text("cq"), new Value(("" + i).getBytes()));
+ m.put(new Text("cf"), new Text("cq"), new Value(Long.toString(i).getBytes(Constants.UTF8)));
break;
case 2:
m = new Mutation(new Text("row"));
- m.put(new Text(key), new Text("cq"), new Value(("" + i).getBytes()));
+ m.put(new Text(key), new Text("cq"), new Value(Long.toString(i).getBytes(Constants.UTF8)));
break;
case 3:
m = new Mutation(new Text("row"));
- m.put(new Text("cf"), new Text(key), new Value(("" + i).getBytes()));
+ m.put(new Text("cf"), new Text(key), new Value(Long.toString(i).getBytes(Constants.UTF8)));
break;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java
index ad4680a..90b3617 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java
@@ -112,7 +112,7 @@ public class BulkFileTest extends FunctionalTest {
private void writeData(FileSKVWriter w, int s, int e) throws Exception {
for (int i = s; i <= e; i++) {
- w.append(new Key(new Text(String.format("%04d", i))), new Value(("" + i).getBytes()));
+ w.append(new Key(new Text(String.format("%04d", i))), new Value(Integer.toString(i).getBytes(Constants.UTF8)));
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
index 0cdd3b7..64db903 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
@@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
@@ -86,7 +87,7 @@ public class BulkSplitOptimizationTest extends FunctionalTest {
String passwd = "";
if (token instanceof PasswordToken) {
- passwd = new String(((PasswordToken) token).getPassword());
+ passwd = new String(((PasswordToken) token).getPassword(), Constants.UTF8);
}
VerifyIngest.main(new String[] {"--timestamp", "1", "--size", "50", "--random", "56", "--rows", "100000", "--start", "0", "--cols", "1", "-p", passwd});
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
index 83a1b4d..cbda17d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.ZooCache;
@@ -52,12 +53,12 @@ public class CacheTestReader {
for (int i = 0; i < numData; i++) {
byte[] v = zc.get(rootDir + "/data" + i);
if (v != null)
- readData.put(rootDir + "/data" + i, new String(v));
+ readData.put(rootDir + "/data" + i, new String(v, Constants.UTF8));
}
byte[] v = zc.get(rootDir + "/dataS");
if (v != null)
- readData.put(rootDir + "/dataS", new String(v));
+ readData.put(rootDir + "/dataS", new String(v, Constants.UTF8));
List<String> children = zc.getChildren(rootDir + "/dir");
if (children != null)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b11a0361/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java
index 0c8afe6..20ea55f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java
@@ -26,6 +26,7 @@ import java.util.Random;
import java.util.TreeMap;
import java.util.UUID;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -83,15 +84,15 @@ public class CacheTestWriter {
// change values
for (int i = 0; i < numData; i++) {
- byte data[] = Long.toString(r.nextLong(), 16).getBytes();
+ byte data[] = Long.toString(r.nextLong(), 16).getBytes(Constants.UTF8);
zk.putPersistentData(rootDir + "/data" + i, data, NodeExistsPolicy.OVERWRITE);
- expectedData.put(rootDir + "/data" + i, new String(data));
+ expectedData.put(rootDir + "/data" + i, new String(data, Constants.UTF8));
}
// test a data node that does not always exists...
if (r.nextFloat() < .5) {
- byte data[] = Long.toString(r.nextLong(), 16).getBytes();
+ byte data[] = Long.toString(r.nextLong(), 16).getBytes(Constants.UTF8);
if (!dataSExists) {
zk.putPersistentData(rootDir + "/dataS", data, NodeExistsPolicy.SKIP);
@@ -100,7 +101,7 @@ public class CacheTestWriter {
zk.putPersistentData(rootDir + "/dataS", data, NodeExistsPolicy.OVERWRITE);
}
- expectedData.put(rootDir + "/dataS", new String(data));
+ expectedData.put(rootDir + "/dataS", new String(data, Constants.UTF8));
} else {
if (dataSExists) {