ACCUMULO-2615 Update Constants.UTF8 to StandardCharsets.UTF_8 for 1.7.x+
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/46f5e8c8 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/46f5e8c8 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/46f5e8c8 Branch: refs/heads/master Commit: 46f5e8c88efbbe4024bbc2d03fe8b08d7d8e8cc9 Parents: a626d57 Author: Bill Havanki <bhava...@cloudera.com> Authored: Mon Jul 14 14:26:11 2014 -0400 Committer: Bill Havanki <bhava...@cloudera.com> Committed: Mon Jul 14 14:26:11 2014 -0400 ---------------------------------------------------------------------- .../accumulo/server/conf/ZooCachePropertyAccessor.java | 4 ++-- .../accumulo/server/conf/NamespaceConfigurationTest.java | 9 +++++---- .../server/conf/ServerConfigurationFactoryTest.java | 4 ++-- .../apache/accumulo/server/conf/TableConfigurationTest.java | 9 +++++---- .../accumulo/server/conf/ZooCachePropertyAccessorTest.java | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/46f5e8c8/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java index ac30008..c021de2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java @@ -16,9 +16,9 @@ */ package org.apache.accumulo.server.conf; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; -import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.AccumuloConfiguration.PropertyFilter; import org.apache.accumulo.core.conf.Property; @@ -106,7 +106,7 @@ public class ZooCachePropertyAccessor { private String get(String path) { byte[] v = propCache.get(path); if (v != null) { - return new String(v, Constants.UTF8); + return new String(v, StandardCharsets.UTF_8); } else { return null; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/46f5e8c8/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java index e7f42af..36ddd3b 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.server.conf; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; import java.util.Map; @@ -85,7 +86,7 @@ public class NamespaceConfigurationTest { public void testGet_InZK() { Property p = Property.INSTANCE_SECRET; expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF + "/" + p.getKey())).andReturn( - "sekrit".getBytes(Constants.UTF8)); + "sekrit".getBytes(StandardCharsets.UTF_8)); replay(zc); assertEquals("sekrit", c.get(Property.INSTANCE_SECRET)); } @@ -122,9 +123,9 @@ public class NamespaceConfigurationTest { children.add("ding"); expect(zc.getChildren(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF)).andReturn(children); expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF + "/" + "foo")).andReturn( - "bar".getBytes(Constants.UTF8)); + "bar".getBytes(StandardCharsets.UTF_8)); expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF + "/" + "ding")).andReturn( - "dong".getBytes(Constants.UTF8)); + "dong".getBytes(StandardCharsets.UTF_8)); replay(zc); c.getProperties(props, filter); assertEquals(2, props.size()); @@ -149,7 +150,7 @@ public class NamespaceConfigurationTest { // need to do a get so the accessor is created Property p = Property.INSTANCE_SECRET; expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF + "/" + p.getKey())).andReturn( - "sekrit".getBytes(Constants.UTF8)); + "sekrit".getBytes(StandardCharsets.UTF_8)); zc.clear(); replay(zc); c.get(Property.INSTANCE_SECRET); http://git-wip-us.apache.org/repos/asf/accumulo/blob/46f5e8c8/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java index bb89b04..9d4a7d2 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.server.conf; -import org.apache.accumulo.core.Constants; +import java.nio.charset.StandardCharsets; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; @@ -54,7 +54,7 @@ public class ServerConfigurationFactoryTest { expect(zc.getChildren(anyObject(String.class))).andReturn(null); expectLastCall().anyTimes(); // ConfigSanityCheck looks at timeout - expect(zc.get(endsWith("timeout"))).andReturn(("" + ZK_TIMEOUT + "ms").getBytes(Constants.UTF8)); + expect(zc.get(endsWith("timeout"))).andReturn(("" + ZK_TIMEOUT + "ms").getBytes(StandardCharsets.UTF_8)); replay(zc); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/46f5e8c8/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java index b7f27cc..a8f213e 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.server.conf; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; import java.util.Map; @@ -85,7 +86,7 @@ public class TableConfigurationTest { public void testGet_InZK() { Property p = Property.INSTANCE_SECRET; expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + p.getKey())) - .andReturn("sekrit".getBytes(Constants.UTF8)); + .andReturn("sekrit".getBytes(StandardCharsets.UTF_8)); replay(zc); assertEquals("sekrit", c.get(Property.INSTANCE_SECRET)); } @@ -110,8 +111,8 @@ public class TableConfigurationTest { children.add("foo"); children.add("ding"); expect(zc.getChildren(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF)).andReturn(children); - expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + "foo")).andReturn("bar".getBytes(Constants.UTF8)); - expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + "ding")).andReturn("dong".getBytes(Constants.UTF8)); + expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + "foo")).andReturn("bar".getBytes(StandardCharsets.UTF_8)); + expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + "ding")).andReturn("dong".getBytes(StandardCharsets.UTF_8)); replay(zc); c.getProperties(props, filter); assertEquals(2, props.size()); @@ -136,7 +137,7 @@ public class TableConfigurationTest { // need to do a get so the accessor is created Property p = Property.INSTANCE_SECRET; expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + p.getKey())) - .andReturn("sekrit".getBytes(Constants.UTF8)); + .andReturn("sekrit".getBytes(StandardCharsets.UTF_8)); zc.clear(); replay(zc); c.get(Property.INSTANCE_SECRET); http://git-wip-us.apache.org/repos/asf/accumulo/blob/46f5e8c8/server/base/src/test/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessorTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessorTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessorTest.java index 77e88b1..a46e1f1 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessorTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessorTest.java @@ -17,9 +17,9 @@ package org.apache.accumulo.server.conf; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; -import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.AccumuloConfiguration.PropertyFilter; import org.apache.accumulo.core.conf.Property; @@ -43,7 +43,7 @@ public class ZooCachePropertyAccessorTest { private static final String KEY = PROP.getKey(); private static final String FULL_PATH = PATH + "/" + KEY; private static final String VALUE = "value"; - private static final byte[] VALUE_BYTES = VALUE.getBytes(Constants.UTF8); + private static final byte[] VALUE_BYTES = VALUE.getBytes(StandardCharsets.UTF_8); private ZooCache zc; private ZooCachePropertyAccessor a;