You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2013/12/20 04:30:20 UTC

git commit: ACCUMULO-1593 Applying Ted's patch to ensure UTF-8 String encoding applied to instance id pulled from ZK.

Updated Branches:
  refs/heads/1.4.5-SNAPSHOT 5a421c7a0 -> 041b482f6


ACCUMULO-1593 Applying Ted's patch to ensure UTF-8 String encoding applied to instance id pulled from ZK.


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

Branch: refs/heads/1.4.5-SNAPSHOT
Commit: 041b482f672bf6a147ac8c9d1646c5aee705d270
Parents: 5a421c7
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 19 22:23:03 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 19 22:23:03 2013 -0500

----------------------------------------------------------------------
 src/core/src/main/java/org/apache/accumulo/core/Constants.java  | 3 +++
 .../java/org/apache/accumulo/core/client/ZooKeeperInstance.java | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/041b482f/src/core/src/main/java/org/apache/accumulo/core/Constants.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/Constants.java b/src/core/src/main/java/org/apache/accumulo/core/Constants.java
index c85649d..6578101 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/Constants.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/Constants.java
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.core;
 
+import java.nio.charset.Charset;
+
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -28,6 +30,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 
 public class Constants {
+  public static final Charset UTF8 = Charset.forName("UTF-8");
   public static final String VERSION = "1.4.5-SNAPSHOT";
   public static final int DATA_VERSION = 4;
   public static final int PREV_DATA_VERSION = 3;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/041b482f/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 4cd4972..fcadd38 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -150,7 +150,7 @@ public class ZooKeeperInstance implements Instance {
         throw new RuntimeException("Instance name " + instanceName
             + " does not exist in zookeeper.  Run \"accumulo org.apache.accumulo.server.util.ListInstances\" to see a list.");
       }
-      instanceId = new String(iidb);
+      instanceId = new String(iidb, Constants.UTF8);
     }
 
     if (zooCache.get(Constants.ZROOT + "/" + instanceId) == null) {
@@ -260,7 +260,8 @@ public class ZooKeeperInstance implements Instance {
     ArgumentChecker.notNull(zooCache, instanceId);
     for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) {
       String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name;
-      UUID iid = UUID.fromString(new String(zooCache.get(instanceNamePath)));
+      byte[] bytes = zooCache.get(instanceNamePath);
+      UUID iid = UUID.fromString(new String(bytes, Constants.UTF8));
       if (iid.equals(instanceId)) {
         return name;
       }