accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [24/26] UTF8, entrySet instead of keySet, unnecessary object creation and string concat.
Date Sat, 01 Feb 2014 03:23:23 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
index 3acf6f1..303449d 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
@@ -732,8 +732,8 @@ public class Tablet {
         computeNumEntries();
       }
       
-      for (Path tpath : paths.keySet()) {
-        log.log(TLevel.TABLET_HIST, extent + " import " + abs2rel(tpath) + " " + paths.get(tpath));
+      for (Entry<Path,DataFileValue> entry : paths.entrySet()) {
+        log.log(TLevel.TABLET_HIST, extent + " import " + abs2rel(entry.getKey()) + " " + entry.getValue());
       }
     }
     
@@ -2415,7 +2415,7 @@ public class Tablet {
     try {
       String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId()
           + Constants.ZTABLE_FLUSH_ID;
-      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null)));
+      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null), Constants.UTF8));
     } catch (InterruptedException e) {
       throw new RuntimeException(e);
     } catch (NumberFormatException nfe) {
@@ -2434,7 +2434,7 @@ public class Tablet {
         + Constants.ZTABLE_COMPACT_CANCEL_ID;
     
     try {
-      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null)));
+      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null), Constants.UTF8));
     } catch (KeeperException e) {
       throw new RuntimeException(e);
     } catch (InterruptedException e) {
@@ -2447,14 +2447,14 @@ public class Tablet {
       String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId()
           + Constants.ZTABLE_COMPACT_ID;
       
-      String[] tokens = new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null)).split(",");
+      String[] tokens = new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null), Constants.UTF8).split(",");
       long compactID = Long.parseLong(tokens[0]);
       
       CompactionIterators iters = new CompactionIterators();
 
       if (tokens.length > 1) {
         Hex hex = new Hex();
-        ByteArrayInputStream bais = new ByteArrayInputStream(hex.decode(tokens[1].split("=")[1].getBytes()));
+        ByteArrayInputStream bais = new ByteArrayInputStream(hex.decode(tokens[1].split("=")[1].getBytes(Constants.UTF8)));
         DataInputStream dis = new DataInputStream(bais);
         
         try {
@@ -3686,9 +3686,8 @@ public class Tablet {
   public void importMapFiles(long tid, Map<String,MapFileInfo> fileMap, boolean setTime) throws IOException {
     Map<String,DataFileValue> entries = new HashMap<String,DataFileValue>(fileMap.size());
     
-    for (String path : fileMap.keySet()) {
-      MapFileInfo mfi = fileMap.get(path);
-      entries.put(path, new DataFileValue(mfi.estimatedSize, 0l));
+    for (Entry<String,MapFileInfo> entry : fileMap.entrySet()) {
+      entries.put(entry.getKey(), new DataFileValue(entry.getValue().estimatedSize, 0l));
     }
     
     // Clients timeout and will think that this operation failed.

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
index 9943926..7f0fc88 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
@@ -499,7 +499,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
         
         ScanRunState srs = nbt.getScanRunState();
         
-        if (nbt == null || srs == ScanRunState.FINISHED)
+        if (srs == ScanRunState.FINISHED)
           continue;
         
         MapCounter<ScanRunState> stateCounts = counts.get(tableID);
@@ -1104,7 +1104,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
         throws NotServingTabletException, ThriftSecurityException, org.apache.accumulo.core.tabletserver.thrift.TooManyFilesException {
       
       Authorizations userauths = null;
-      if (!security.canScan(credentials, new String(textent.getTable())))
+      if (!security.canScan(credentials, new String(textent.getTable(), Constants.UTF8)))
         throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
       
       userauths = security.getUserAuthorizations(credentials);
@@ -1255,7 +1255,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
       // find all of the tables that need to be scanned
       HashSet<String> tables = new HashSet<String>();
       for (TKeyExtent keyExtent : tbatch.keySet()) {
-        tables.add(new String(keyExtent.getTable()));
+        tables.add(new String(keyExtent.getTable(), Constants.UTF8));
       }
       
       // check if user has permission to the tables
@@ -1650,7 +1650,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     public void update(TInfo tinfo, TCredentials credentials, TKeyExtent tkeyExtent, TMutation tmutation) throws NotServingTabletException,
         ConstraintViolationException, ThriftSecurityException {
 
-      if (!security.canWrite(credentials, new String(tkeyExtent.getTable())))
+      if (!security.canWrite(credentials, new String(tkeyExtent.getTable(), Constants.UTF8)))
         throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
       KeyExtent keyExtent = new KeyExtent(tkeyExtent);
       Tablet tablet = onlineTablets.get(new KeyExtent(keyExtent));
@@ -1699,7 +1699,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     public void splitTablet(TInfo tinfo, TCredentials credentials, TKeyExtent tkeyExtent, ByteBuffer splitPoint)
         throws NotServingTabletException, ThriftSecurityException {
       
-      String tableId = new String(ByteBufferUtil.toBytes(tkeyExtent.table));
+      String tableId = new String(ByteBufferUtil.toBytes(tkeyExtent.table), Constants.UTF8);
       if (!security.canSplitTablet(credentials, tableId))
         throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
       
@@ -2717,7 +2717,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
         }
       };
       
-      byte[] lockContent = new ServerServices(getClientAddressString(), Service.TSERV_CLIENT).toString().getBytes();
+      byte[] lockContent = new ServerServices(getClientAddressString(), Service.TSERV_CLIENT).toString().getBytes(Constants.UTF8);
       for (int i = 0; i < 120 / 5; i++) {
         zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.SKIP);
         

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
index 9629948..6baecfd 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
@@ -50,13 +50,13 @@ public class UniqueNameAllocator {
       try {
         byte[] max = ZooReaderWriter.getRetryingInstance().mutate(nextNamePath, null, ZooUtil.PRIVATE, new ZooReaderWriter.Mutator() {
           public byte[] mutate(byte[] currentValue) throws Exception {
-            long l = Long.parseLong(new String(currentValue), Character.MAX_RADIX);
+            long l = Long.parseLong(new String(currentValue, Constants.UTF8), Character.MAX_RADIX);
             l += allocate;
-            return Long.toString(l, Character.MAX_RADIX).getBytes();
+            return Long.toString(l, Character.MAX_RADIX).getBytes(Constants.UTF8);
           }
         });
         
-        maxAllocated = Long.parseLong(new String(max), Character.MAX_RADIX);
+        maxAllocated = Long.parseLong(new String(max, Constants.UTF8), Character.MAX_RADIX);
         next = maxAllocated - allocate;
         
       } catch (Exception e) {
@@ -64,7 +64,7 @@ public class UniqueNameAllocator {
       }
     }
     
-    return new String(FastFormat.toZeroPaddedString(next++, 7, Character.MAX_RADIX, new byte[0]));
+    return new String(FastFormat.toZeroPaddedString(next++, 7, Character.MAX_RADIX, new byte[0]), Constants.UTF8);
   }
   
   private static UniqueNameAllocator instance = null;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
index ded2962..64bac29 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/log/DfsLogger.java
@@ -32,6 +32,7 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
@@ -225,7 +226,7 @@ public class DfsLogger {
   public static FSDataInputStream readHeader(FileSystem fs, Path path, Map<String,String> opts) throws IOException {
     FSDataInputStream file = fs.open(path);
     try {
-      byte[] magic = LOG_FILE_HEADER_V2.getBytes();
+      byte[] magic = LOG_FILE_HEADER_V2.getBytes(Constants.UTF8);
       byte[] buffer = new byte[magic.length];
       file.readFully(buffer);
       if (Arrays.equals(buffer, magic)) {
@@ -286,13 +287,13 @@ public class DfsLogger {
           .getConfiguration().get(Property.CRYPTO_MODULE_CLASS));
 
       // Initialize the log file with a header and the crypto params used to set up this log file.
-      logFile.write(LOG_FILE_HEADER_V2.getBytes());
+      logFile.write(LOG_FILE_HEADER_V2.getBytes(Constants.UTF8));
       Map<String,String> cryptoOpts = conf.getConfiguration().getAllPropertiesWithPrefix(Property.CRYPTO_PREFIX);
 
       logFile.writeInt(cryptoOpts.size());
-      for (String key : cryptoOpts.keySet()) {
-        logFile.writeUTF(key);
-        logFile.writeUTF(cryptoOpts.get(key));
+      for (Entry<String,String> entry : cryptoOpts.entrySet()) {
+        logFile.writeUTF(entry.getKey());
+        logFile.writeUTF(entry.getValue());
       }
 
       @SuppressWarnings("deprecation")

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/metrics/TabletServerScanMetrics.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/metrics/TabletServerScanMetrics.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/metrics/TabletServerScanMetrics.java
index e2dad1b..801b441 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/metrics/TabletServerScanMetrics.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/metrics/TabletServerScanMetrics.java
@@ -26,7 +26,7 @@ public class TabletServerScanMetrics extends AbstractMetricsImpl implements Tabl
   
   public static final String METRICS_PREFIX = "tserver.scan";
   
-  public static ObjectName OBJECT_NAME = null;
+  static ObjectName OBJECT_NAME = null;
   
   public TabletServerScanMetrics() {
     super();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java b/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
index 116f134..ffab38c 100644
--- a/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
@@ -128,7 +128,7 @@ public class TraceServer implements Watcher {
       Mutation spanMutation = new Mutation(new Text(idString));
       Mutation indexMutation = new Mutation(new Text("idx:" + s.svc + ":" + startString));
       long diff = s.stop - s.start;
-      indexMutation.put(new Text(s.description), new Text(s.sender), new Value((idString + ":" + Long.toHexString(diff)).getBytes()));
+      indexMutation.put(new Text(s.description), new Text(s.sender), new Value((idString + ":" + Long.toHexString(diff)).getBytes(Constants.UTF8)));
       ByteArrayTransport transport = new ByteArrayTransport();
       TCompactProtocol protocol = new TCompactProtocol(transport);
       s.write(protocol);
@@ -181,7 +181,7 @@ public class TraceServer implements Watcher {
         Map<String,String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_TOKEN_PROPERTY_PREFIX);
         if (loginMap.isEmpty()) {
           Property p = Property.TRACE_PASSWORD;
-          at = new PasswordToken(conf.get(p).getBytes());
+          at = new PasswordToken(conf.get(p).getBytes(Constants.UTF8));
         } else {
           Properties props = new Properties();
           AuthenticationToken token = AccumuloClassLoader.getClassLoader().loadClass(conf.get(Property.TRACE_TOKEN_TYPE)).asSubclass(AuthenticationToken.class)
@@ -281,7 +281,7 @@ public class TraceServer implements Watcher {
   private void registerInZooKeeper(String name) throws Exception {
     String root = ZooUtil.getRoot(serverConfiguration.getInstance()) + Constants.ZTRACERS;
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
-    String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes());
+    String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes(Constants.UTF8));
     zoo.exists(path, this);
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java b/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
index f7fb387..d018228 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
@@ -124,7 +124,7 @@ public class AddFilesWithMissingEntries {
         String size = Long.toString(file.getLen());
         String entries = "1"; // lie
         String value = size + "," + entries;
-        m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(filename), new Value(value.getBytes()));
+        m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(filename), new Value(value.getBytes(Constants.UTF8)));
         if (update) {
           writer.getBatchWriter(Constants.METADATA_TABLE_NAME).addMutation(m);
         }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java b/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
index 0fd1c78..ac13034 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -137,7 +138,7 @@ public class ChangeSecret {
     });
     String path = "/accumulo/instances/" + inst.getInstanceName();
     orig.recursiveDelete(path, NodeMissingPolicy.SKIP);
-    new_.putPersistentData(path, newInstanceId.getBytes(), NodeExistsPolicy.OVERWRITE);
+    new_.putPersistentData(path, newInstanceId.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
     return newInstanceId;
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java b/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
index b7a90d3..f2074a1 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
@@ -53,7 +53,7 @@ public class CleanZookeeper {
     String root = Constants.ZROOT;
     IZooReaderWriter zk = ZooReaderWriter.getInstance();
     if (opts.auth != null) {
-      zk.getZooKeeper().addAuthInfo("digest", ("accumulo:"+opts.auth).getBytes());
+      zk.getZooKeeper().addAuthInfo("digest", ("accumulo:"+opts.auth).getBytes(Constants.UTF8));
     }
     
     try {
@@ -62,7 +62,7 @@ public class CleanZookeeper {
           for (String instanceName : zk.getChildren(root + Constants.ZINSTANCES)) {
             String instanceNamePath = root + Constants.ZINSTANCES + "/" + instanceName;
             byte[] id = zk.getData(instanceNamePath, null);
-            if (id != null && !new String(id).equals(HdfsZooInstance.getInstance().getInstanceID())) {
+            if (id != null && !new String(id, Constants.UTF8).equals(HdfsZooInstance.getInstance().getInstanceID())) {
               try {
                 zk.recursiveDelete(instanceNamePath, NodeMissingPolicy.SKIP);
               } catch (KeeperException.NoAuthException ex) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java b/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
index a74f2b5..448da86 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
@@ -65,13 +65,13 @@ public class DeleteZooInstance {
       String path = Constants.ZROOT + Constants.ZINSTANCES + "/" + opts.instance;
       byte[] data = zk.getData(path, null);
       deleteRetry(zk, path);
-      deleteRetry(zk, Constants.ZROOT + "/" + new String(data));
+      deleteRetry(zk, Constants.ZROOT + "/" + new String(data, Constants.UTF8));
     } else if (uuids.contains(opts.instance)) {
       // look for the real instance name
       for (String instance : instances) {
         String path = Constants.ZROOT + Constants.ZINSTANCES + "/" + instance;
         byte[] data = zk.getData(path, null);
-        if (opts.instance.equals(new String(data)))
+        if (opts.instance.equals(new String(data, Constants.UTF8)))
           deleteRetry(zk, path);
       }
       deleteRetry(zk, Constants.ZROOT + "/" + opts.instance);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java b/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
index d1858a1..95f6a32 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
@@ -60,8 +60,6 @@ public class DumpZookeeper {
     
     Logger.getRootLogger().setLevel(Level.WARN);
     PrintStream out = System.out;
-    if (args.length > 0)
-      opts.root = opts.root;
     try {
       zk = ZooReaderWriter.getInstance();
       

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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/c06a72d8/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() {


Mime
View raw message