accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [25/26] git commit: UTF8, entrySet instead of keySet, unnecessary object creation and string concat.
Date Sat, 01 Feb 2014 03:23:24 GMT
UTF8, entrySet instead of keySet, unnecessary object creation and string concat.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c06a72d8
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c06a72d8
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c06a72d8

Branch: refs/heads/2292-findbugs
Commit: c06a72d8e9cfd89b1aa362907464832a93eaf465
Parents: 9a9b419
Author: Josh Elser <elserj@apache.org>
Authored: Fri Jan 31 17:19:42 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Jan 31 22:18:53 2014 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/server/Accumulo.java    |  4 +-
 .../accumulo/server/client/HdfsZooInstance.java |  8 ++--
 .../server/conf/TableConfiguration.java         |  2 +-
 .../accumulo/server/conf/ZooConfiguration.java  |  2 +-
 .../server/constraints/MetadataConstraints.java | 10 ++--
 .../server/gc/SimpleGarbageCollector.java       |  6 +--
 .../accumulo/server/logger/LogFileValue.java    | 12 +++--
 .../accumulo/server/logger/LogReader.java       |  3 +-
 .../accumulo/server/master/LiveTServerSet.java  |  2 +-
 .../apache/accumulo/server/master/Master.java   | 18 ++++----
 .../server/master/recovery/RecoveryManager.java |  2 +-
 .../server/master/state/DeadServerList.java     |  5 +-
 .../server/master/state/MergeStats.java         |  6 +--
 .../master/state/MetaDataTableScanner.java      |  2 +-
 .../server/master/state/SetGoalState.java       |  2 +-
 .../server/master/state/TServerInstance.java    |  4 +-
 .../master/state/TabletStateChangeIterator.java |  5 +-
 .../accumulo/server/master/state/ZooStore.java  |  3 +-
 .../master/state/ZooTabletStateStore.java       |  8 ++--
 .../master/state/tables/TableManager.java       | 20 ++++----
 .../server/master/tableOps/BulkImport.java      |  6 +--
 .../master/tableOps/CancelCompactions.java      | 10 ++--
 .../server/master/tableOps/CompactRange.java    | 16 +++----
 .../server/master/tableOps/ExportTable.java     |  6 +--
 .../server/master/tableOps/ImportTable.java     | 10 ++--
 .../server/master/tableOps/RenameTable.java     |  4 +-
 .../accumulo/server/master/tableOps/Utils.java  | 21 +++++----
 .../master/tserverOps/ShutdownTServer.java      |  2 +-
 .../accumulo/server/metanalysis/IndexMeta.java  |  6 +--
 .../server/metrics/AbstractMetricsImpl.java     | 12 +++--
 .../accumulo/server/monitor/LogService.java     |  2 +-
 .../apache/accumulo/server/monitor/Monitor.java |  4 +-
 .../server/monitor/ZooKeeperStatus.java         |  5 +-
 .../server/monitor/servlets/DefaultServlet.java |  3 +-
 .../server/monitor/servlets/LogServlet.java     |  6 +--
 .../server/monitor/servlets/ShellServlet.java   |  5 +-
 .../monitor/servlets/TServersServlet.java       |  3 +-
 .../server/monitor/servlets/trace/Basic.java    |  3 +-
 .../server/monitor/servlets/trace/ListType.java |  2 +-
 .../server/security/SecurityConstants.java      |  2 +-
 .../server/security/SecurityOperation.java      |  4 +-
 .../security/handler/ZKAuthenticator.java       |  2 +-
 .../server/security/handler/ZKAuthorizor.java   |  2 +-
 .../server/security/handler/ZKPermHandler.java  |  6 +--
 .../tabletserver/BulkFailedCopyProcessor.java   |  3 +-
 .../accumulo/server/tabletserver/Compactor.java |  2 +-
 .../server/tabletserver/InMemoryMap.java        |  5 +-
 .../accumulo/server/tabletserver/Tablet.java    | 17 ++++---
 .../server/tabletserver/TabletServer.java       | 12 ++---
 .../tabletserver/UniqueNameAllocator.java       |  8 ++--
 .../server/tabletserver/log/DfsLogger.java      | 11 +++--
 .../metrics/TabletServerScanMetrics.java        |  2 +-
 .../accumulo/server/trace/TraceServer.java      |  6 +--
 .../server/util/AddFilesWithMissingEntries.java |  2 +-
 .../accumulo/server/util/ChangeSecret.java      |  3 +-
 .../accumulo/server/util/CleanZookeeper.java    |  4 +-
 .../accumulo/server/util/DeleteZooInstance.java |  4 +-
 .../accumulo/server/util/DumpZookeeper.java     |  2 -
 .../accumulo/server/util/EmbeddedWebServer.java |  9 ++--
 .../org/apache/accumulo/server/util/Info.java   |  2 +-
 .../apache/accumulo/server/util/Initialize.java | 48 ++++++++++----------
 .../accumulo/server/util/ListInstances.java     |  4 +-
 .../accumulo/server/util/LocalityCheck.java     |  8 ++--
 .../accumulo/server/util/MetadataTable.java     | 48 ++++++++++----------
 .../util/RemoveEntriesForMissingFiles.java      |  2 +-
 .../accumulo/server/util/RestoreZookeeper.java  |  5 +-
 .../accumulo/server/util/SendLogToChainsaw.java | 15 +++---
 .../accumulo/server/util/SystemPropUtil.java    |  2 +-
 .../accumulo/server/util/TablePropUtil.java     |  2 +-
 .../accumulo/server/util/TabletServerLocks.java |  2 +-
 .../server/zookeeper/DistributedWorkQueue.java  |  2 +-
 .../accumulo/server/zookeeper/ZooQueueLock.java |  7 +--
 .../server/zookeeper/ZooReaderWriter.java       |  3 +-
 73 files changed, 270 insertions(+), 236 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/src/main/java/org/apache/accumulo/server/Accumulo.java
index ce99245..f4da33b 100644
--- a/server/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -99,7 +99,7 @@ public class Accumulo {
     
     private void setMonitorPort() {
       try {
-        String port = new String(ZooReaderWriter.getInstance().getData(path, null));
+        String port = new String(ZooReaderWriter.getInstance().getData(path, null), Constants.UTF8);
         System.setProperty("org.apache.accumulo.core.host.log.port", port);
         log.info("Changing monitor log4j port to "+port);
         doOnChange();
@@ -215,7 +215,7 @@ public class Accumulo {
             try {
               byte[] buffer = new byte[10];
               int bytes = is.read(buffer);
-              String setting = new String(buffer, 0, bytes);
+              String setting = new String(buffer, 0, bytes, Constants.UTF8);
               setting = setting.trim();
               if (bytes > 0 && Integer.parseInt(setting) > 10) {
                 log.warn("System swappiness setting is greater than ten (" + setting + ") which can cause time-sensitive operations to be delayed. "

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
index 615dd38..3e0c63f 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
@@ -86,13 +86,13 @@ public class HdfsZooInstance implements Instance {
 
     byte[] loc = zooCache.get(zRootLocPath);
 
-    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc, Constants.UTF8)) + " in %DURATION%");
 
     if (loc == null) {
       return null;
     }
 
-    return new String(loc).split("\\|")[0];
+    return new String(loc, Constants.UTF8).split("\\|")[0];
   }
 
   @Override
@@ -104,13 +104,13 @@ public class HdfsZooInstance implements Instance {
 
     byte[] loc = ZooLock.getLockData(zooCache, masterLocPath, null);
 
-    opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+    opTimer.stop("Found master at " + (loc == null ? null : new String(loc, Constants.UTF8)) + " in %DURATION%");
 
     if (loc == null) {
       return Collections.emptyList();
     }
 
-    return Collections.singletonList(new String(loc));
+    return Collections.singletonList(new String(loc, Constants.UTF8));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
index 0a26b47..c5b6c18 100644
--- a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
+++ b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
@@ -121,7 +121,7 @@ public class TableConfiguration extends AccumuloConfiguration {
     byte[] v = getTablePropCache().get(zPath);
     String value = null;
     if (v != null)
-      value = new String(v);
+      value = new String(v, Constants.UTF8);
     return value;
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
index d006498..15d7d8c 100644
--- a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
+++ b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
@@ -116,7 +116,7 @@ public class ZooConfiguration extends AccumuloConfiguration {
     byte[] v = propCache.get(zPath);
     String value = null;
     if (v != null)
-      value = new String(v);
+      value = new String(v, Constants.UTF8);
     return value;
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java b/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
index dfdb620..88c8593 100644
--- a/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
+++ b/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
@@ -186,7 +186,7 @@ public class MetadataConstraints implements Constraint {
           HashSet<Text> dataFiles = new HashSet<Text>();
           HashSet<Text> loadedFiles = new HashSet<Text>();
 
-          String tidString = new String(columnUpdate.getValue());
+          String tidString = new String(columnUpdate.getValue(), Constants.UTF8);
           int otherTidCount = 0;
 
           for (ColumnUpdate update : mutation.getUpdates()) {
@@ -199,7 +199,7 @@ public class MetadataConstraints implements Constraint {
             } else if (new Text(update.getColumnFamily()).equals(Constants.METADATA_BULKFILE_COLUMN_FAMILY)) {
               loadedFiles.add(new Text(update.getColumnQualifier()));
               
-              if (!new String(update.getValue()).equals(tidString)) {
+              if (!new String(update.getValue(), Constants.UTF8).equals(tidString)) {
                 otherTidCount++;
               }
             }
@@ -243,7 +243,7 @@ public class MetadataConstraints implements Constraint {
           }
           
           boolean lockHeld = false;
-          String lockId = new String(columnUpdate.getValue());
+          String lockId = new String(columnUpdate.getValue(), Constants.UTF8);
           
           try {
             lockHeld = ZooLock.isLockHeld(zooCache, new ZooUtil.LockID(zooRoot, lockId));
@@ -260,9 +260,9 @@ public class MetadataConstraints implements Constraint {
     }
     
     if (violations != null) {
-      log.debug("violating metadata mutation : " + new String(mutation.getRow()));
+      log.debug("violating metadata mutation : " + new String(mutation.getRow(), Constants.UTF8));
       for (ColumnUpdate update : mutation.getUpdates()) {
-        log.debug(" update: " + new String(update.getColumnFamily()) + ":" + new String(update.getColumnQualifier()) + " value " + (update.isDeleted() ? "[delete]" : new String(update.getValue())));
+        log.debug(" update: " + new String(update.getColumnFamily(), Constants.UTF8) + ":" + new String(update.getColumnQualifier(), Constants.UTF8) + " value " + (update.isDeleted() ? "[delete]" : new String(update.getValue(), Constants.UTF8)));
       }
     }
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
index af8e308..5627698 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
@@ -406,7 +406,7 @@ public class SimpleGarbageCollector implements Iface {
     
     while (true) {
       lock = new ZooLock(path);
-      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes())) {
+      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes(Constants.UTF8))) {
         break;
       }
       UtilWaitThread.sleep(1000);
@@ -572,7 +572,7 @@ public class SimpleGarbageCollector implements Iface {
           if (cf.startsWith("../")) {
             delete = cf.substring(2);
           } else {
-            String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()));
+            String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()), Constants.UTF8);
             delete = "/" + table + cf;
           }
           // WARNING: This line is EXTREMELY IMPORTANT.
@@ -584,7 +584,7 @@ public class SimpleGarbageCollector implements Iface {
           if (candidates.remove(path))
             log.debug("Candidate was still in use in the METADATA table: " + path);
         } else if (Constants.METADATA_DIRECTORY_COLUMN.hasColumns(entry.getKey())) {
-          String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()));
+          String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()), Constants.UTF8);
           String delete = "/" + table + entry.getValue().toString();
           if (candidates.remove(delete))
             log.debug("Candidate was still in use in the METADATA table: " + delete);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java b/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
index 6019b18..25ad054 100644
--- a/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
+++ b/server/src/main/java/org/apache/accumulo/server/logger/LogFileValue.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.ColumnUpdate;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.server.data.ServerMutation;
@@ -58,7 +59,7 @@ public class LogFileValue implements Writable {
   }
   
   private static String displayLabels(byte[] labels) {
-    String s = new String(labels);
+    String s = new String(labels, Constants.UTF8);
     s = s.replace("&", " & ");
     s = s.replace("|", " | ");
     return s;
@@ -75,12 +76,13 @@ public class LogFileValue implements Writable {
         builder.append("...");
         break;
       }
-      builder.append("  " + new String(m.getRow()) + "\n");
+      builder.append("  ").append(new String(m.getRow(), Constants.UTF8)).append("\n");
       for (ColumnUpdate update : m.getUpdates()) {
         String value = new String(update.getValue());
-        builder.append("      " + new String(update.getColumnFamily()) + ":" + new String(update.getColumnQualifier()) + " "
-            + (update.hasTimestamp() ? "[user]:" : "[system]:") + update.getTimestamp() + " [" + displayLabels(update.getColumnVisibility()) + "] "
-            + (update.isDeleted() ? "<deleted>" : value) + "\n");
+        builder.append("      ").append(new String(update.getColumnFamily(), Constants.UTF8)).append(":")
+                .append(new String(update.getColumnQualifier(), Constants.UTF8)).append(" ").append(update.hasTimestamp() ? "[user]:" : "[system]:")
+                .append(update.getTimestamp()).append(" [").append(displayLabels(update.getColumnVisibility())).append("] ")
+                .append(update.isDeleted() ? "<deleted>" : value).append("\n");
       }
     }
     return builder.toString();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java b/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
index ba9d694..4f9d33a 100644
--- a/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
+++ b/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
@@ -167,7 +168,7 @@ public class LogReader {
           }
           
           if (rowMatcher != null) {
-            rowMatcher.reset(new String(m.getRow()));
+            rowMatcher.reset(new String(m.getRow(), Constants.UTF8));
             if (rowMatcher.matches()) {
               found = true;
               break;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index c038479..e0d9e56 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -287,7 +287,7 @@ public class LiveTServerSet implements Watcher {
       }
     } else {
       locklessServers.remove(server);
-      ServerServices services = new ServerServices(new String(lockData));
+      ServerServices services = new ServerServices(new String(lockData, Constants.UTF8));
       InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
       InetSocketAddress addr = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
       TServerInstance instance = new TServerInstance(client, stat.getEphemeralOwner());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/Master.java b/server/src/main/java/org/apache/accumulo/server/master/Master.java
index 396c219..ccb8622 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -286,7 +286,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
         
         for (String id : Tables.getIdToNameMap(instance).keySet()) {
           
-          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(),
+          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(Constants.UTF8),
               NodeExistsPolicy.SKIP);
         }
       } catch (Exception ex) {
@@ -499,9 +499,9 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
         fid = zoo.mutate(zTablePath, null, null, new Mutator() {
           @Override
           public byte[] mutate(byte[] currentValue) throws Exception {
-            long flushID = Long.parseLong(new String(currentValue));
+            long flushID = Long.parseLong(new String(currentValue, Constants.UTF8));
             flushID++;
-            return ("" + flushID).getBytes();
+            return Long.toString(flushID).getBytes(Constants.UTF8);
           }
         });
       } catch (NoNodeException nne) {
@@ -510,7 +510,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
         log.warn(e.getMessage(), e);
         throw new ThriftTableOperationException(tableId, null, TableOperation.FLUSH, TableOperationExceptionType.OTHER, null);
       }
-      return Long.parseLong(new String(fid));
+      return Long.parseLong(new String(fid, Constants.UTF8));
     }
     
     @Override
@@ -1110,7 +1110,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
   
   private void setMasterGoalState(MasterGoalState state) {
     try {
-      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(),
+      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(Constants.UTF8),
           NodeExistsPolicy.OVERWRITE);
     } catch (Exception ex) {
       log.error("Unable to set master goal state in zookeeper");
@@ -1121,7 +1121,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     while (true)
       try {
         byte[] data = ZooReaderWriter.getInstance().getData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, null);
-        return MasterGoalState.valueOf(new String(data));
+        return MasterGoalState.valueOf(new String(data, Constants.UTF8));
       } catch (Exception e) {
         log.error("Problem getting real goal state: " + e);
         UtilWaitThread.sleep(1000);
@@ -1742,7 +1742,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
         }
         
         if (maxLogicalTime != null)
-          Constants.METADATA_TIME_COLUMN.put(m, new Value(maxLogicalTime.getBytes()));
+          Constants.METADATA_TIME_COLUMN.put(m, new Value(maxLogicalTime.getBytes(Constants.UTF8)));
         
         if (!m.getUpdates().isEmpty()) {
           bw.addMutation(m);
@@ -2176,7 +2176,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     InetSocketAddress sock = org.apache.accumulo.core.util.AddressUtil.parseAddress(hostname, serverPort.port);
     String address = org.apache.accumulo.core.util.AddressUtil.toString(sock);
     log.info("Setting master lock data to " + address);
-    masterLock.replaceLockData(address.getBytes());
+    masterLock.replaceLockData(address.getBytes(Constants.UTF8));
     
     while (!clientService.isServing()) {
       UtilWaitThread.sleep(100);
@@ -2267,7 +2267,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
       
       MasterLockWatcher masterLockWatcher = new MasterLockWatcher();
       masterLock = new ZooLock(zMasterLoc);
-      masterLock.lockAsync(masterLockWatcher, masterClientAddress.getBytes());
+      masterLock.lockAsync(masterLockWatcher, masterClientAddress.getBytes(Constants.UTF8));
 
       masterLockWatcher.waitForChange();
       

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java b/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
index d6e9717..78e2e5b 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoveryManager.java
@@ -110,7 +110,7 @@ public class RecoveryManager {
   
   private void initiateSort(String host, final String file) throws KeeperException, InterruptedException {
     String source = getSource(host, file).toString();
-    new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY).addWork(file, source.getBytes());
+    new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY).addWork(file, source.getBytes(Constants.UTF8));
     
     synchronized (this) {
       sortsQueued.add(file);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java b/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
index b2ea7d6..72fe94b 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.master.state;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.master.thrift.DeadServer;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -50,7 +51,7 @@ public class DeadServerList {
         for (String child : children) {
           Stat stat = new Stat();
           byte[] data = zoo.getData(path + "/" + child, stat);
-          DeadServer server = new DeadServer(child, stat.getMtime(), new String(data));
+          DeadServer server = new DeadServer(child, stat.getMtime(), new String(data, Constants.UTF8));
           result.add(server);
         }
       }
@@ -72,7 +73,7 @@ public class DeadServerList {
   public void post(String server, String cause) {
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
-      zoo.putPersistentData(path + "/" + server, cause.getBytes(), NodeExistsPolicy.SKIP);
+      zoo.putPersistentData(path + "/" + server, cause.getBytes(Constants.UTF8), NodeExistsPolicy.SKIP);
     } catch (Exception ex) {
       log.error(ex, ex);
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java b/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
index 7984a83..e11ba69 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
@@ -243,9 +243,9 @@ public class MergeStats {
     
     Connector conn = opts.getConnector();
     Map<String,String> tableIdMap = conn.tableOperations().tableIdMap();
-    for (String table : tableIdMap.keySet()) {
-      String tableId = tableIdMap.get(table);
-      String path = ZooUtil.getRoot(conn.getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId.toString() + "/merge";
+    for (Entry<String,String> entry : tableIdMap.entrySet()) {
+      final String table = entry.getKey(), tableId = entry.getValue();
+      String path = ZooUtil.getRoot(conn.getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId + "/merge";
       MergeInfo info = new MergeInfo();
       if (ZooReaderWriter.getInstance().exists(path)) {
         byte[] data = ZooReaderWriter.getInstance().getData(path, new Stat());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
index 1bddb4b..4ef16bf 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
@@ -91,7 +91,7 @@ public class MetaDataTableScanner implements Iterator<TabletLocationState> {
     }
   }
   
-  public void finalize() {
+  protected void finalize() {
     close();
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java b/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java
index 816d8f9..cafe62b 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java
@@ -43,7 +43,7 @@ public class SetGoalState {
 
     FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), ServerConfiguration.getSiteConfiguration());
     Accumulo.waitForZookeeperAndHdfs(fs);
-    ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(),
+    ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(Constants.UTF8),
         NodeExistsPolicy.OVERWRITE);
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java b/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
index d829144..fedfd76 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
@@ -54,7 +54,7 @@ public class TServerInstance implements Comparable<TServerInstance>, Serializabl
   }
   
   public TServerInstance(Value address, Text session) {
-    this(AddressUtil.parseAddress(new String(address.get()), Property.TSERV_CLIENTPORT), session.toString());
+    this(AddressUtil.parseAddress(new String(address.get(), Constants.UTF8), Property.TSERV_CLIENTPORT), session.toString());
   }
   
   public void putLocation(Mutation m) {
@@ -115,7 +115,7 @@ public class TServerInstance implements Comparable<TServerInstance>, Serializabl
   }
   
   public Value asMutationValue() {
-    return new Value(org.apache.accumulo.core.util.AddressUtil.toString(getLocation()).getBytes());
+    return new Value(org.apache.accumulo.core.util.AddressUtil.toString(getLocation()).getBytes(Constants.UTF8));
   }
   
   public InetSocketAddress getLocation() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java b/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
index 6e1096d..71bddad 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -94,7 +95,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     try {
       Map<Text,MergeInfo> result = new HashMap<Text,MergeInfo>();
       DataInputBuffer buffer = new DataInputBuffer();
-      byte[] data = Base64.decodeBase64(merges.getBytes());
+      byte[] data = Base64.decodeBase64(merges.getBytes(Constants.UTF8));
       buffer.reset(data, data.length);
       while (buffer.available() > 0) {
         MergeInfo mergeInfo = new MergeInfo();
@@ -182,7 +183,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }
-    String encoded = new String(Base64.encodeBase64(Arrays.copyOf(buffer.getData(), buffer.getLength())));
+    String encoded = new String(Base64.encodeBase64(Arrays.copyOf(buffer.getData(), buffer.getLength())), Constants.UTF8);
     cfg.addOption(MERGES_OPTION, encoded);
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java b/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
index bce6681..b0ed03f 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.master.state;
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -74,7 +75,7 @@ public class ZooStore implements DistributedStore {
       path = relative(path);
       ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE);
       cache.clear();
-      log.debug("Wrote " + new String(bs) + " to " + path);
+      log.debug("Wrote " + new String(bs, Constants.UTF8) + " to " + path);
     } catch (Exception ex) {
       throw new DistributedStoreException(ex);
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java b/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
index 496caa8..486c664 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
@@ -104,7 +104,7 @@ public class ZooTabletStateStore extends TabletStateStore {
   }
   
   protected TServerInstance parse(byte[] current) {
-    String str = new String(current);
+    String str = new String(current, Constants.UTF8);
     String[] parts = str.split("[|]", 2);
     InetSocketAddress address = AddressUtil.parseAddress(parts[0], 0);
     if (parts.length > 1 && parts[1] != null && parts[1].length() > 0) {
@@ -128,7 +128,7 @@ public class ZooTabletStateStore extends TabletStateStore {
     if (current.current != null) {
       throw new IllegalDSException("Trying to set the root tablet location: it is already set to " + current.current);
     }
-    store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes());
+    store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes(Constants.UTF8));
   }
   
   @Override
@@ -147,8 +147,8 @@ public class ZooTabletStateStore extends TabletStateStore {
     if (!current.future.equals(assignment.server)) {
       throw new IllegalDSException("Root tablet is already assigned to " + current.future);
     }
-    store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes());
-    store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes());
+    store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes(Constants.UTF8));
+    store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes(Constants.UTF8));
     // Make the following unnecessary by making the entire update atomic 
     store.remove(Constants.ZROOT_TABLET_FUTURE_LOCATION);
     log.debug("Put down root tablet location");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java b/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
index fedbc96..574959e 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
@@ -49,6 +49,8 @@ public class TableManager {
   private static final Set<TableObserver> observers = Collections.synchronizedSet(new HashSet<TableObserver>());
   private static final Map<String,TableState> tableStateCache = Collections.synchronizedMap(new HashMap<String,TableState>());
   
+  private static final byte[] ZERO_BYTE = "0".getBytes(Constants.UTF8); 
+  
   private static TableManager tableManager = null;
   
   private final Instance instance;
@@ -61,11 +63,11 @@ public class TableManager {
     IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
     zoo.putPersistentData(zTablePath, new byte[0], existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_CONF, new byte[0], existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_STATE, state.name().getBytes(), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_FLUSH_ID, "0".getBytes(), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_ID, "0".getBytes(), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(Constants.UTF8), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_STATE, state.name().getBytes(Constants.UTF8), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_FLUSH_ID, ZERO_BYTE, existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_ID, ZERO_BYTE, existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_CANCEL_ID, ZERO_BYTE, existsPolicy);
   }
   
   public synchronized static TableManager getInstance() {
@@ -113,12 +115,12 @@ public class TableManager {
     String statePath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
     
     try {
-      ZooReaderWriter.getRetryingInstance().mutate(statePath, (byte[]) newState.name().getBytes(), ZooUtil.PUBLIC, new Mutator() {
+      ZooReaderWriter.getRetryingInstance().mutate(statePath, (byte[]) newState.name().getBytes(Constants.UTF8), ZooUtil.PUBLIC, new Mutator() {
         @Override
         public byte[] mutate(byte[] oldData) throws Exception {
           TableState oldState = TableState.UNKNOWN;
           if (oldData != null)
-            oldState = TableState.valueOf(new String(oldData));
+            oldState = TableState.valueOf(new String(oldData, Constants.UTF8));
           boolean transition = true;
           // +--------+
           // v |
@@ -140,7 +142,7 @@ public class TableManager {
           if (!transition)
             throw new IllegalTableTransitionException(oldState, newState);
           log.debug("Transitioning state for table " + tableId + " from " + oldState + " to " + newState);
-          return newState.name().getBytes();
+          return newState.name().getBytes(Constants.UTF8);
         }
       });
     } catch (Exception e) {
@@ -162,7 +164,7 @@ public class TableManager {
       TableState tState = TableState.UNKNOWN;
       byte[] data = zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE);
       if (data != null) {
-        String sState = new String(data);
+        String sState = new String(data, Constants.UTF8);
         try {
           tState = TableState.valueOf(sState);
         } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
index 27f4202..5e85277 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
@@ -378,7 +378,7 @@ class CopyFailed extends MasterRepo {
     HashMap<String,String> loadedFailures = new HashMap<String,String>();
     
     FSDataInputStream failFile = fs.open(new Path(error, BulkImport.FAILURES_TXT));
-    BufferedReader in = new BufferedReader(new InputStreamReader(failFile));
+    BufferedReader in = new BufferedReader(new InputStreamReader(failFile, Constants.UTF8));
     try {
       String line = null;
       while ((line = in.readLine()) != null) {
@@ -432,7 +432,7 @@ class CopyFailed extends MasterRepo {
         if (fs.exists(dest))
           continue;
         
-        bifCopyQueue.addWork(orig.getName(), (failure + "," + dest).getBytes());
+        bifCopyQueue.addWork(orig.getName(), (failure + "," + dest).getBytes(Constants.UTF8));
         workIds.add(orig.getName());
         log.debug("tid " + tid + " added to copyq: " + orig + " to " + dest + ": failed");
       }
@@ -567,7 +567,7 @@ class LoadFiles extends MasterRepo {
     }
     
     FSDataOutputStream failFile = fs.create(new Path(errorDir, BulkImport.FAILURES_TXT), true);
-    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile));
+    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile, Constants.UTF8));
     try {
       for (String f : filesToLoad) {
         out.write(f);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/CancelCompactions.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CancelCompactions.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CancelCompactions.java
index efddc79..e67cfe3 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CancelCompactions.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CancelCompactions.java
@@ -72,19 +72,19 @@ public class CancelCompactions extends MasterRepo {
     
     byte[] currentValue = zoo.getData(zCompactID, null);
     
-    String cvs = new String(currentValue);
+    String cvs = new String(currentValue, Constants.UTF8);
     String[] tokens = cvs.split(",");
-    final long flushID = Long.parseLong(new String(tokens[0]));
+    final long flushID = Long.parseLong(tokens[0]);
     
     zoo.mutate(zCancelID, null, null, new Mutator() {
       @Override
       public byte[] mutate(byte[] currentValue) throws Exception {
-        long cid = Long.parseLong(new String(currentValue));
+        long cid = Long.parseLong(new String(currentValue, Constants.UTF8));
         
         if (cid < flushID)
-          return (flushID + "").getBytes();
+          return Long.toString(flushID).getBytes(Constants.UTF8);
         else
-          return (cid + "").getBytes();
+          return Long.toString(cid).getBytes(Constants.UTF8);
 
       }
     });

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
index 36a0c5e..4bca64a 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
@@ -307,9 +307,9 @@ public class CompactRange extends MasterRepo {
       cid = zoo.mutate(zTablePath, null, null, new Mutator() {
         @Override
         public byte[] mutate(byte[] currentValue) throws Exception {
-          String cvs = new String(currentValue);
+          String cvs = new String(currentValue, Constants.UTF8);
           String[] tokens = cvs.split(",");
-          long flushID = Long.parseLong(new String(tokens[0]));
+          long flushID = Long.parseLong(tokens[0]);
           flushID++;
           
           String txidString = String.format("%016x", tid);
@@ -329,14 +329,14 @@ public class CompactRange extends MasterRepo {
             encodedIterators.append(",");
             encodedIterators.append(txidString);
             encodedIterators.append("=");
-            encodedIterators.append(new String(hex.encode(iterators)));
+            encodedIterators.append(new String(hex.encode(iterators), Constants.UTF8));
           }
           
-          return ("" + flushID + encodedIterators).getBytes();
+          return (Long.toString(flushID) + encodedIterators).getBytes(Constants.UTF8);
         }
       });
       
-      return new CompactionDriver(Long.parseLong(new String(cid).split(",")[0]), tableId, startRow, endRow);
+      return new CompactionDriver(Long.parseLong(new String(cid, Constants.UTF8).split(",")[0]), tableId, startRow, endRow);
     } catch (NoNodeException nne) {
       throw new ThriftTableOperationException(tableId, null, TableOperation.COMPACT, TableOperationExceptionType.NOTFOUND, null);
     }
@@ -351,9 +351,9 @@ public class CompactRange extends MasterRepo {
     zoo.mutate(zTablePath, null, null, new Mutator() {
       @Override
       public byte[] mutate(byte[] currentValue) throws Exception {
-        String cvs = new String(currentValue);
+        String cvs = new String(currentValue, Constants.UTF8);
         String[] tokens = cvs.split(",");
-        long flushID = Long.parseLong(new String(tokens[0]));
+        long flushID = Long.parseLong(tokens[0]);
 
         String txidString = String.format("%016x", txid);
         
@@ -365,7 +365,7 @@ public class CompactRange extends MasterRepo {
           encodedIterators.append(tokens[i]);
         }
         
-        return ("" + flushID + encodedIterators).getBytes();
+        return (Long.toString(flushID) + encodedIterators).getBytes(Constants.UTF8);
       }
     });
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
index 6a3ebc5..b7e250b 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
@@ -153,7 +153,7 @@ class WriteExportFiles extends MasterRepo {
     try {
       
       zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_INFO_FILE));
-      OutputStreamWriter osw = new OutputStreamWriter(dataOut);
+      OutputStreamWriter osw = new OutputStreamWriter(dataOut, Constants.UTF8);
       osw.append(ExportTable.EXPORT_VERSION_PROP + ":" + ExportTable.VERSION + "\n");
       osw.append("srcInstanceName:" + conn.getInstance().getInstanceName() + "\n");
       osw.append("srcInstanceID:" + conn.getInstance().getInstanceID() + "\n");
@@ -183,7 +183,7 @@ class WriteExportFiles extends MasterRepo {
   }
   
   private static void createDistcpFile(FileSystem fs, String exportDir, Path exportMetaFilePath, Map<String,String> uniqueFiles) throws IOException {
-    BufferedWriter distcpOut = new BufferedWriter(new OutputStreamWriter(fs.create(new Path(exportDir, "distcp.txt"), false)));
+    BufferedWriter distcpOut = new BufferedWriter(new OutputStreamWriter(fs.create(new Path(exportDir, "distcp.txt"), false), Constants.UTF8));
     
     try {
       URI uri = fs.getUri();
@@ -264,7 +264,7 @@ class WriteExportFiles extends MasterRepo {
     
     TableConfiguration tableConfig = ServerConfiguration.getTableConfiguration(conn.getInstance(), tableID);
     
-    OutputStreamWriter osw = new OutputStreamWriter(dataOut);
+    OutputStreamWriter osw = new OutputStreamWriter(dataOut, Constants.UTF8);
     
     // only put props that are different than defaults and higher level configurations
     zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_TABLE_CONFIG_FILE));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
index b54e543..9f01734 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
@@ -176,7 +176,7 @@ class PopulateMetadataTable extends MasterRepo {
   }
   
   static Map<String,String> readMappingFile(FileSystem fs, ImportedTableInfo tableInfo) throws Exception {
-    BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(tableInfo.importDir, "mappings.txt"))));
+    BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(tableInfo.importDir, "mappings.txt")), Constants.UTF8));
     
     try {
       Map<String,String> map = new HashMap<String,String>();
@@ -250,14 +250,14 @@ class PopulateMetadataTable extends MasterRepo {
             
             if (m == null) {
               m = new Mutation(metadataRow);
-              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))));
               currentRow = metadataRow;
             }
             
             if (!currentRow.equals(metadataRow)) {
               mbw.addMutation(m);
               m = new Mutation(metadataRow);
-              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))));
             }
             
             m.put(key.getColumnFamily(), cq, val);
@@ -324,7 +324,7 @@ class MapImportFileNames extends MasterRepo {
       
       UniqueNameAllocator namer = UniqueNameAllocator.getInstance();
       
-      mappingsWriter = new BufferedWriter(new OutputStreamWriter(fs.create(path)));
+      mappingsWriter = new BufferedWriter(new OutputStreamWriter(fs.create(path), Constants.UTF8));
       
       for (FileStatus fileStatus : files) {
         String fileName = fileStatus.getPath().getName();
@@ -553,7 +553,7 @@ public class ImportTable extends MasterRepo {
       ZipEntry zipEntry;
       while ((zipEntry = zis.getNextEntry()) != null) {
         if (zipEntry.getName().equals(Constants.EXPORT_INFO_FILE)) {
-          BufferedReader in = new BufferedReader(new InputStreamReader(zis));
+          BufferedReader in = new BufferedReader(new InputStreamReader(zis, Constants.UTF8));
           String line = null;
           while ((line = in.readLine()) != null) {
             String sa[] = line.split(":", 2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
index 0ca29cd..b38e841 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
@@ -62,14 +62,14 @@ public class RenameTable extends MasterRepo {
       
       zoo.mutate(tap, null, null, new Mutator() {
         public byte[] mutate(byte[] current) throws Exception {
-          final String currentName = new String(current);
+          final String currentName = new String(current, Constants.UTF8);
           if (currentName.equals(newTableName))
             return null; // assume in this case the operation is running again, so we are done
           if (!currentName.equals(oldTableName)) {
             throw new ThriftTableOperationException(null, oldTableName, TableOperation.RENAME, TableOperationExceptionType.NOTFOUND,
                 "Name changed while processing");
           }
-          return newTableName.getBytes();
+          return newTableName.getBytes(Constants.UTF8);
         }
       });
       Tables.clearCache(instance);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
index d467119..bb2a222 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
@@ -39,6 +39,7 @@ import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 
 public class Utils {
+  private static final byte[] ZERO_BYTE = "0".getBytes(Constants.UTF8);
   
   static void checkTableDoesNotExist(Instance instance, String tableName, String tableId, TableOperation operation) throws ThriftTableOperationException {
     
@@ -54,15 +55,15 @@ public class Utils {
     try {
       IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
       final String ntp = ZooUtil.getRoot(instance) + Constants.ZTABLES;
-      byte[] nid = zoo.mutate(ntp, "0".getBytes(), ZooUtil.PUBLIC, new Mutator() {
+      byte[] nid = zoo.mutate(ntp, ZERO_BYTE, ZooUtil.PUBLIC, new Mutator() {
         @Override
         public byte[] mutate(byte[] currentValue) throws Exception {
-          BigInteger nextId = new BigInteger(new String(currentValue), Character.MAX_RADIX);
+          BigInteger nextId = new BigInteger(new String(currentValue, Constants.UTF8), Character.MAX_RADIX);
           nextId = nextId.add(BigInteger.ONE);
-          return nextId.toString(Character.MAX_RADIX).getBytes();
+          return nextId.toString(Character.MAX_RADIX).getBytes(Constants.UTF8);
         }
       });
-      return new String(nid);
+      return new String(nid, Constants.UTF8);
     } catch (Exception e1) {
       Logger.getLogger(CreateTable.class).error("Failed to assign tableId to " + tableName, e1);
       throw new ThriftTableOperationException(tableId, tableName, TableOperation.CREATE, TableOperationExceptionType.OTHER, e1.getMessage());
@@ -94,9 +95,10 @@ public class Utils {
   
   public static long reserveHdfsDirectory(String directory, long tid) throws KeeperException, InterruptedException {
     Instance instance = HdfsZooInstance.getInstance();
-    
-    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + new String(Base64.encodeBase64(directory.getBytes()));
-    
+
+    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/"
+        + new String(Base64.encodeBase64(directory.getBytes(Constants.UTF8)), Constants.UTF8);
+
     IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
     
     if (ZooReservation.attempt(zk, resvPath, String.format("%016x", tid), "")) {
@@ -107,12 +109,13 @@ public class Utils {
   
   public static void unreserveHdfsDirectory(String directory, long tid) throws KeeperException, InterruptedException {
     Instance instance = HdfsZooInstance.getInstance();
-    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + new String(Base64.encodeBase64(directory.getBytes()));
+    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/"
+        + new String(Base64.encodeBase64(directory.getBytes(Constants.UTF8)), Constants.UTF8);
     ZooReservation.release(ZooReaderWriter.getRetryingInstance(), resvPath, String.format("%016x", tid));
   }
   
   private static Lock getLock(String tableId, long tid, boolean writeLock) throws Exception {
-    byte[] lockData = String.format("%016x", tid).getBytes();
+    byte[] lockData = String.format("%016x", tid).getBytes(Constants.UTF8);
     ZooQueueLock qlock = new ZooQueueLock(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTABLE_LOCKS + "/" + tableId, false);
     Lock lock = DistributedReadWriteLock.recoverLock(qlock, lockData);
     if (lock == null) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java b/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
index d411ac4..4e5f273 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
@@ -59,7 +59,7 @@ public class ShutdownTServer extends MasterRepo {
       ZooLock.deleteLock(path);
       path = ZooUtil.getRoot(master.getInstance()) + Constants.ZDEADTSERVERS + "/" + tserver;
       IZooReaderWriter zoo = ZooReaderWriter.getInstance();
-      zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
+      zoo.putPersistentData(path, "forced down".getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
       return null;
     }
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java b/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
index 68a364a..de781fc 100644
--- a/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
+++ b/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
@@ -104,14 +104,14 @@ public class IndexMeta extends Configured implements Tool {
       
       if (prevRow != null) {
         Mutation createEvent = new Mutation(new Text(m.getRow()));
-        createEvent.put(prevRow, new Text(String.format("%020d", timestamp)), new Value(metaTablet.toString().getBytes()));
+        createEvent.put(prevRow, new Text(String.format("%020d", timestamp)), new Value(metaTablet.toString().getBytes(Constants.UTF8)));
         context.write(CREATE_EVENTS_TABLE, createEvent);
       }
       
       Mutation tabletEvent = new Mutation(new Text(m.getRow()));
       tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mut"), new Value(serMut));
-      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mtab"), new Value(metaTablet.toString().getBytes()));
-      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("log"), new Value(logFile.getBytes()));
+      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mtab"), new Value(metaTablet.toString().getBytes(Constants.UTF8)));
+      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("log"), new Value(logFile.getBytes(Constants.UTF8)));
       context.write(TABLET_EVENTS_TABLE, tabletEvent);
     }
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/metrics/AbstractMetricsImpl.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/metrics/AbstractMetricsImpl.java b/server/src/main/java/org/apache/accumulo/server/metrics/AbstractMetricsImpl.java
index a047507..5a8ddec 100644
--- a/server/src/main/java/org/apache/accumulo/server/metrics/AbstractMetricsImpl.java
+++ b/server/src/main/java/org/apache/accumulo/server/metrics/AbstractMetricsImpl.java
@@ -17,8 +17,10 @@
 package org.apache.accumulo.server.metrics;
 
 import java.io.File;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 import java.lang.management.ManagementFactory;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -28,6 +30,7 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.management.StandardMBean;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.time.DateUtils;
 
@@ -99,7 +102,7 @@ public abstract class AbstractMetricsImpl {
   
   private File logFile = null;
   
-  private FileWriter logWriter = null;
+  private Writer logWriter = null;
   
   private SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
   
@@ -176,7 +179,8 @@ public abstract class AbstractMetricsImpl {
       if (null != mDir) {
         File dir = new File(mDir);
         if (!dir.isDirectory())
-          dir.mkdir();
+          if (!dir.mkdir()) 
+            log.warn("Could not create log directory: " + dir);
         logDir = dir;
         // Create new log file
         startNewLog();
@@ -198,7 +202,7 @@ public abstract class AbstractMetricsImpl {
         return;
       }
     }
-    logWriter = new FileWriter(logFile, true);
+    logWriter = new OutputStreamWriter(new FileOutputStream(logFile, true), Constants.UTF8);
   }
   
   private void writeToLog(String name) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/LogService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/LogService.java b/server/src/main/java/org/apache/accumulo/server/monitor/LogService.java
index ce5dab8..10ef9e4 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/LogService.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/LogService.java
@@ -82,7 +82,7 @@ public class LogService extends org.apache.log4j.AppenderSkeleton {
     try {
       SocketServer server = new SocketServer(conf.getPort(Property.MONITOR_LOG4J_PORT));
       ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instanceId) + Constants.ZMONITOR_LOG4J_PORT,
-          Integer.toString(server.getLocalPort()).getBytes(), NodeExistsPolicy.OVERWRITE);
+          Integer.toString(server.getLocalPort()).getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
       new Daemon(server).start();
     } catch (Throwable t) {
       log.info("Unable to listen to cluster-wide ports", t);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
index 3836916..dcb80fd 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
@@ -424,7 +424,7 @@ public class Monitor {
       List<String> locks = zk.getChildren(path, null);
       if (locks != null && locks.size() > 0) {
         Collections.sort(locks);
-        address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null))).getAddress(Service.GC_CLIENT);
+        address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null), Constants.UTF8)).getAddress(Service.GC_CLIENT);
         GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(), address, config.getConfiguration());
         try {
           result = client.getStatus(Tracer.traceInfo(), SecurityConstants.getSystemCredentials());
@@ -489,7 +489,7 @@ public class Monitor {
       log.debug("Using " + hostname + " to advertise monitor location in ZooKeeper");
       
       String monitorAddress = org.apache.accumulo.core.util.AddressUtil.toString(new InetSocketAddress(hostname, server.getPort()));
-      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, monitorAddress.getBytes(),
+      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, monitorAddress.getBytes(Constants.UTF8),
           NodeExistsPolicy.OVERWRITE);
       log.info("Set monitor address in zookeeper to " + monitorAddress);
     } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/ZooKeeperStatus.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/ZooKeeperStatus.java b/server/src/main/java/org/apache/accumulo/server/monitor/ZooKeeperStatus.java
index c3ef3a0..1c84a1c 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/ZooKeeperStatus.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/ZooKeeperStatus.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.TTimeoutTransport;
 import org.apache.accumulo.core.util.UtilWaitThread;
@@ -98,14 +99,14 @@ public class ZooKeeperStatus implements Runnable {
             addr = new InetSocketAddress(parts[0], 2181);
           
           transport = TTimeoutTransport.create(addr, 10 * 1000l);
-          transport.write("stat\n".getBytes(), 0, 5);
+          transport.write("stat\n".getBytes(Constants.UTF8), 0, 5);
           StringBuilder response = new StringBuilder();
           try {
             transport.flush();
             byte[] buffer = new byte[1024 * 100];
             int n = 0;
             while ((n = transport.read(buffer, 0, buffer.length)) > 0) {
-              response.append(new String(buffer, 0, n));
+              response.append(new String(buffer, 0, n, Constants.UTF8));
             }
           } catch (TTransportException ex) {
             // happens at EOF

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
index 0bdd34d..b17868e 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
@@ -39,6 +39,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
@@ -85,7 +86,7 @@ public class DefaultServlet extends BasicServlet {
           while ((n = data.read(buffer)) > 0)
             out.write(buffer, 0, n);
         } else {
-          out.write(("could not get resource " + path + "").getBytes());
+          out.write(("could not get resource " + path + "").getBytes(Constants.UTF8));
         }
       } finally {
         if (data != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/LogServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/LogServlet.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/LogServlet.java
index fcb9742..be00aaa 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/LogServlet.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/LogServlet.java
@@ -68,11 +68,11 @@ public class LogServlet extends BasicServlet {
         }
         
       }
-      msg = text.toString();
+      StringBuilder builder = new StringBuilder(text.toString());
       if (ev.getThrowableStrRep() != null)
         for (String line : ev.getThrowableStrRep())
-          msg += "\n\t" + line;
-      msg = sanitize(msg.trim());
+          builder.append("\n\t").append(line);
+      msg = sanitize(builder.toString().trim());
       msg = "<pre class='logevent'>" + msg + "</pre>";
       logTable.addRow(ev.getTimeStamp(), application, dev.getCount(), ev.getLevel(), msg);
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
index 07ecc3d..07cf029 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpSession;
 
 import jline.ConsoleReader;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.util.shell.Shell;
 
 public class ShellServlet extends BasicServlet {
@@ -225,8 +226,8 @@ public class ShellServlet extends BasicServlet {
       this.cmdIndex = 0;
       this.readWait = false;
       this.output = new StringBuilderOutputStream();
-      ConsoleReader reader = new ConsoleReader(this, new OutputStreamWriter(output));
-      this.shell = new Shell(reader, new PrintWriter(output));
+      ConsoleReader reader = new ConsoleReader(this, new OutputStreamWriter(output, Constants.UTF8));
+      this.shell = new Shell(reader, new PrintWriter(new OutputStreamWriter(output, Constants.UTF8)));
       shell.setLogErrorsToConsole();
       if (mock != null) {
         if (shell.config("--fake", "-u", username, "-p", password))

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
index 095725e..487c61d 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.master.thrift.DeadServer;
 import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
@@ -167,7 +168,7 @@ public class TServersServlet extends BasicServlet {
       if (extent.getEndRow() != null && extent.getEndRow().getLength() > 0) {
         digester.update(extent.getEndRow().getBytes(), 0, extent.getEndRow().getLength());
       }
-      String obscuredExtent = new String(Base64.encodeBase64(digester.digest()));
+      String obscuredExtent = new String(Base64.encodeBase64(digester.digest()), Constants.UTF8);
       String displayExtent = String.format("<code>[%s]</code>", obscuredExtent);
       
       TableRow row = perTabletResults.prepareRow();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
index 74e6f0f..333eaf4 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
@@ -22,6 +22,7 @@ import java.util.Map.Entry;
 
 import javax.servlet.http.HttpServletRequest;
 
+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.Connector;
@@ -74,7 +75,7 @@ abstract class Basic extends BasicServlet {
     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();
       int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length() + 1;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java
index 99a5571..cab2015 100644
--- a/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java
+++ b/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java
@@ -64,7 +64,7 @@ public class ListType extends Basic {
     for (Entry<Key,Value> entry : scanner) {
       RemoteSpan span = TraceFormatter.getRemoteSpan(entry);
       if (span.description.equals(type)) {
-        trace.addRow(span, new Long(span.stop - span.start), span.svc + ":" + span.sender);
+        trace.addRow(span, Long.valueOf(span.stop - span.start), span.svc + ":" + span.sender);
       }
     }
     trace.generate(req, sb);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java b/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
index 60d3a68..a857a49 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
@@ -43,7 +43,7 @@ public class SecurityConstants {
   private static final AuthenticationToken SYSTEM_TOKEN = makeSystemPassword();
   private static final TCredentials systemCredentials = CredentialHelper.createSquelchError(SYSTEM_PRINCIPAL, SYSTEM_TOKEN, HdfsZooInstance.getInstance()
       .getInstanceID());
-  public static byte[] confChecksum = null;
+  static byte[] confChecksum = null;
   
   public static AuthenticationToken getSystemToken() {
     return SYSTEM_TOKEN;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
index 2c5aa7d..2d70796 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
@@ -56,7 +56,7 @@ public class SecurityOperation {
   private final ZooCache zooCache;
   private final String ZKUserPath;
 
-  protected static SecurityOperation instance;
+  static SecurityOperation instance;
 
   public static synchronized SecurityOperation getInstance() {
     String instanceId = HdfsZooInstance.getInstance().getInstanceID();
@@ -133,7 +133,7 @@ public class SecurityOperation {
 
   public synchronized String getRootUsername() {
     if (rootUserName == null)
-      rootUserName = new String(zooCache.get(ZKUserPath));
+      rootUserName = new String(zooCache.get(ZKUserPath), Constants.UTF8);
     return rootUserName;
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
index 3ea1c88..ebbe0dd 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
@@ -70,7 +70,7 @@ public final class ZKAuthenticator implements Authenticator {
         }
         
         // prep parent node of users with root username
-        zoo.putPersistentData(ZKUserPath, principal.getBytes(), NodeExistsPolicy.FAIL);
+        zoo.putPersistentData(ZKUserPath, principal.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
         
         constructUser(principal, ZKSecurityTool.createPass(token));
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
index 89ed3b2..36bd86a 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
@@ -87,7 +87,7 @@ public class ZKAuthorizor implements Authorizor {
     try {
       // prep parent node of users with root username
       if (!zoo.exists(ZKUserPath))
-        zoo.putPersistentData(ZKUserPath, rootuser.getBytes(), NodeExistsPolicy.FAIL);
+        zoo.putPersistentData(ZKUserPath, rootuser.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
       
       initUser(rootuser);
       zoo.putPersistentData(ZKUserPath + "/" + rootuser + ZKUserAuths, ZKSecurityTool.convertAuthorizations(Constants.NO_AUTHS), NodeExistsPolicy.FAIL);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
index ff5ab01..4a05658 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
@@ -49,8 +49,8 @@ public class ZKPermHandler implements PermissionHandler {
   private String ZKUserPath;
   private String ZKTablePath;
   private final ZooCache zooCache;
-  private final String ZKUserSysPerms = "/System";
-  private final String ZKUserTablePerms = "/Tables";
+  private static final String ZKUserSysPerms = "/System";
+  private static final String ZKUserTablePerms = "/Tables";
   
   public static synchronized PermissionHandler getInstance() {
     if (zkPermHandlerInstance == null)
@@ -257,7 +257,7 @@ public class ZKPermHandler implements PermissionHandler {
     try {
       // prep parent node of users with root username
       if (!zoo.exists(ZKUserPath))
-        zoo.putPersistentData(ZKUserPath, rootuser.getBytes(), NodeExistsPolicy.FAIL);
+        zoo.putPersistentData(ZKUserPath, rootuser.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
       
       initUser(rootuser);
       zoo.putPersistentData(ZKUserPath + "/" + rootuser + ZKUserSysPerms, ZKSecurityTool.convertSystemPermissions(rootPerms), NodeExistsPolicy.FAIL);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/BulkFailedCopyProcessor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/BulkFailedCopyProcessor.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/BulkFailedCopyProcessor.java
index c543881..868f6a1 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/BulkFailedCopyProcessor.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/BulkFailedCopyProcessor.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.tabletserver;
 
 import java.io.IOException;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.trace.TraceFileSystem;
@@ -42,7 +43,7 @@ public class BulkFailedCopyProcessor implements Processor {
   @Override
   public void process(String workID, byte[] data) {
     
-    String paths[] = new String(data).split(",");
+    String paths[] = new String(data, Constants.UTF8).split(",");
     
     Path orig = new Path(paths[0]);
     Path dest = new Path(paths[1]);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
index dbf0c3c..4437492 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
@@ -152,7 +152,7 @@ public class Compactor implements Callable<CompactionStats> {
     entriesWritten.set(0);
   }
 
-  protected static Set<Compactor> runningCompactions = Collections.synchronizedSet(new HashSet<Compactor>());
+  protected static final Set<Compactor> runningCompactions = Collections.synchronizedSet(new HashSet<Compactor>());
   
   public static class CompactionInfo {
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c06a72d8/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
index 57f36c3..f914c33 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.server.tabletserver;
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -64,8 +65,10 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Logger;
 
-class MemKeyComparator implements Comparator<Key> {
+class MemKeyComparator implements Comparator<Key>, Serializable {
   
+  private static final long serialVersionUID = 1L;
+
   @Override
   public int compare(Key k1, Key k2) {
     int cmp = k1.compareTo(k2);


Mime
View raw message