accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject accumulo git commit: ACCUMULO-4304 Use built-in Java 8 Base64 correctly
Date Mon, 09 May 2016 23:49:35 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 8e789f61d -> a6ecb7a41


ACCUMULO-4304 Use built-in Java 8 Base64 correctly

Replaces unnecessary encoding/decoding of base64-encoded bytes with
UTF-8, and instead uses the built-in decode(String) and
encodeToString(byte[]) methods which are equivalent.

Remove commons-codec dependency from modules which no longer use any
commons-codec classes.


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

Branch: refs/heads/master
Commit: a6ecb7a413e7a65e480df723b95306690efd0670
Parents: 8e789f6
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Mon May 9 19:46:55 2016 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Mon May 9 19:46:55 2016 -0400

----------------------------------------------------------------------
 core/pom.xml                                    |  4 ---
 .../accumulo/core/client/impl/Credentials.java  | 12 ++++----
 .../core/client/mapreduce/RangeInputSplit.java  |  5 ++--
 .../mapreduce/lib/impl/ConfiguratorBase.java    |  5 ++--
 .../mapreduce/lib/impl/InputConfigurator.java   | 24 ++++++++--------
 .../lib/partition/RangePartitioner.java         |  2 +-
 .../iterators/user/IntersectingIterator.java    | 10 +++----
 .../core/rpc/SaslDigestCallbackHandler.java     |  9 +++---
 .../accumulo/core/security/Authorizations.java  |  4 +--
 .../apache/accumulo/core/util/CreateToken.java  |  6 ++--
 .../org/apache/accumulo/core/util/Encoding.java |  6 ++--
 .../client/mapred/AccumuloInputFormatTest.java  |  3 +-
 .../mapreduce/AccumuloInputFormatTest.java      |  3 +-
 .../lib/impl/ConfiguratorBaseTest.java          |  3 +-
 examples/simple/pom.xml                         |  4 ---
 .../mapreduce/bulk/BulkIngestExample.java       |  4 +--
 maven-plugin/src/it/plugin-test/pom.xml         |  4 ---
 .../master/state/TabletStateChangeIterator.java | 10 +++----
 .../security/handler/KerberosAuthenticator.java | 10 +++----
 .../security/handler/KerberosAuthorizor.java    | 12 ++++----
 .../handler/KerberosPermissionHandler.java      | 30 ++++++++++----------
 .../accumulo/server/util/DumpZookeeper.java     |  2 +-
 .../apache/accumulo/master/tableOps/Utils.java  |  4 +--
 server/monitor/pom.xml                          |  4 ---
 .../monitor/servlets/TServersServlet.java       |  4 +--
 shell/pom.xml                                   |  4 ---
 .../org/apache/accumulo/shell/ShellUtil.java    |  2 +-
 .../accumulo/shell/commands/FateCommand.java    |  2 +-
 .../shell/commands/GetSplitsCommand.java        |  7 ++---
 .../accumulo/shell/commands/HiddenCommand.java  |  4 +--
 .../test/randomwalk/shard/BulkInsert.java       |  2 +-
 .../accumulo/test/util/SerializationUtil.java   | 10 +++----
 .../test/TraceRepoDeserializationTest.java      |  3 +-
 33 files changed, 89 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index b00a65f..a63c5ea 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -40,10 +40,6 @@
       <artifactId>guava</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
index 13b2463..92d1bd3 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
@@ -109,9 +109,9 @@ public class Credentials {
    * @return serialized form of these credentials
    */
   public final String serialize() {
-    return (getPrincipal() == null ? "-" : new String(Base64.getEncoder().encode(getPrincipal().getBytes(UTF_8)), UTF_8)) + ":"
-        + (getToken() == null ? "-" : new String(Base64.getEncoder().encode(getToken().getClass().getName().getBytes(UTF_8)), UTF_8)) + ":"
-        + (getToken() == null ? "-" : new String(Base64.getEncoder().encode(AuthenticationTokenSerializer.serialize(getToken())), UTF_8));
+    return (getPrincipal() == null ? "-" : Base64.getEncoder().encodeToString(getPrincipal().getBytes(UTF_8))) + ":"
+        + (getToken() == null ? "-" : Base64.getEncoder().encodeToString(getToken().getClass().getName().getBytes(UTF_8))) + ":"
+        + (getToken() == null ? "-" : Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(getToken())));
   }
 
   /**
@@ -123,11 +123,11 @@ public class Credentials {
    */
   public static final Credentials deserialize(String serializedForm) {
     String[] split = serializedForm.split(":", 3);
-    String principal = split[0].equals("-") ? null : new String(Base64.getDecoder().decode(split[0].getBytes(UTF_8)), UTF_8);
-    String tokenType = split[1].equals("-") ? null : new String(Base64.getDecoder().decode(split[1].getBytes(UTF_8)), UTF_8);
+    String principal = split[0].equals("-") ? null : new String(Base64.getDecoder().decode(split[0]), UTF_8);
+    String tokenType = split[1].equals("-") ? null : new String(Base64.getDecoder().decode(split[1]), UTF_8);
     AuthenticationToken token = null;
     if (!split[2].equals("-")) {
-      byte[] tokenBytes = Base64.getDecoder().decode(split[2].getBytes(UTF_8));
+      byte[] tokenBytes = Base64.getDecoder().decode(split[2]);
       token = AuthenticationTokenSerializer.deserialize(tokenType, tokenBytes);
     }
     return new Credentials(principal, token);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 46498de..06cb50e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -184,8 +184,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
       switch (this.tokenSource) {
         case INLINE:
           String tokenClass = in.readUTF();
-          byte[] base64TokenBytes = in.readUTF().getBytes(UTF_8);
-          byte[] tokenBytes = Base64.getDecoder().decode(base64TokenBytes);
+          byte[] tokenBytes = Base64.getDecoder().decode(in.readUTF());
 
           this.token = AuthenticationTokenSerializer.deserialize(tokenClass, tokenBytes);
           break;
@@ -280,7 +279,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
         throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
       } else if (null != token) {
         out.writeUTF(token.getClass().getName());
-        out.writeUTF(new String(Base64.getEncoder().encode(AuthenticationTokenSerializer.serialize(token)), UTF_8));
+        out.writeUTF(Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
       } else {
         out.writeUTF(tokenFile);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java
index a74425b..942c746 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java
@@ -17,7 +17,6 @@
 package org.apache.accumulo.core.client.mapreduce.lib.impl;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.util.Objects.requireNonNull;
 
 import java.io.ByteArrayInputStream;
@@ -156,7 +155,7 @@ public class ConfiguratorBase {
           + delToken.getServiceName().toString());
     } else {
       conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), TokenSource.INLINE.prefix() + token.getClass().getName() + ":"
-          + new String(Base64.getEncoder().encode(AuthenticationTokenSerializer.serialize(token)), UTF_8));
+          + Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
     }
   }
 
@@ -244,7 +243,7 @@ public class ConfiguratorBase {
     if (token.startsWith(TokenSource.INLINE.prefix())) {
       String[] args = token.substring(TokenSource.INLINE.prefix().length()).split(":", 2);
       if (args.length == 2)
-        return AuthenticationTokenSerializer.deserialize(args[0], Base64.getDecoder().decode(args[1].getBytes(UTF_8)));
+        return AuthenticationTokenSerializer.deserialize(args[0], Base64.getDecoder().decode(args[1]));
     } else if (token.startsWith(TokenSource.FILE.prefix())) {
       String tokenFileName = token.substring(TokenSource.FILE.prefix().length());
       return getTokenFromFile(conf, getPrincipal(implementingClass, conf), tokenFileName);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index 06bf930..28aadf7 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
@@ -214,7 +214,7 @@ public class InputConfigurator extends ConfiguratorBase {
       for (Range r : ranges) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         r.write(new DataOutputStream(baos));
-        rangeStrings.add(new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8));
+        rangeStrings.add(Base64.getEncoder().encodeToString(baos.toByteArray()));
       }
       conf.setStrings(enumToConfKey(implementingClass, ScanOpts.RANGES), rangeStrings.toArray(new String[0]));
     } catch (IOException ex) {
@@ -240,7 +240,7 @@ public class InputConfigurator extends ConfiguratorBase {
     Collection<String> encodedRanges = conf.getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES));
     List<Range> ranges = new ArrayList<Range>();
     for (String rangeString : encodedRanges) {
-      ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString.getBytes(UTF_8)));
+      ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString));
       Range range = new Range();
       range.readFields(new DataInputStream(bais));
       ranges.add(range);
@@ -272,7 +272,7 @@ public class InputConfigurator extends ConfiguratorBase {
     try {
       while (tokens.hasMoreTokens()) {
         String itstring = tokens.nextToken();
-        ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(itstring.getBytes(UTF_8)));
+        ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(itstring));
         list.add(new IteratorSetting(new DataInputStream(bais)));
         bais.close();
       }
@@ -310,9 +310,9 @@ public class InputConfigurator extends ConfiguratorBase {
       if (column.getFirst() == null)
         throw new IllegalArgumentException("Column family can not be null");
 
-      String col = new String(Base64.getEncoder().encode(TextUtil.getBytes(column.getFirst())), UTF_8);
+      String col = Base64.getEncoder().encodeToString(TextUtil.getBytes(column.getFirst()));
       if (column.getSecond() != null)
-        col += ":" + new String(Base64.getEncoder().encode(TextUtil.getBytes(column.getSecond())), UTF_8);
+        col += ":" + Base64.getEncoder().encodeToString(TextUtil.getBytes(column.getSecond()));
       columnStrings.add(col);
     }
 
@@ -352,8 +352,8 @@ public class InputConfigurator extends ConfiguratorBase {
 
     for (String col : serialized) {
       int idx = col.indexOf(":");
-      Text cf = new Text(idx < 0 ? Base64.getDecoder().decode(col.getBytes(UTF_8)) : Base64.getDecoder().decode(col.substring(0, idx).getBytes(UTF_8)));
-      Text cq = idx < 0 ? null : new Text(Base64.getDecoder().decode(col.substring(idx + 1).getBytes(UTF_8)));
+      Text cf = new Text(idx < 0 ? Base64.getDecoder().decode(col) : Base64.getDecoder().decode(col.substring(0, idx)));
+      Text cq = idx < 0 ? null : new Text(Base64.getDecoder().decode(col.substring(idx + 1)));
       columns.add(new Pair<Text,Text>(cf, cq));
     }
     return columns;
@@ -377,7 +377,7 @@ public class InputConfigurator extends ConfiguratorBase {
     String newIter;
     try {
       cfg.write(new DataOutputStream(baos));
-      newIter = new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8);
+      newIter = Base64.getEncoder().encodeToString(baos.toByteArray());
       baos.close();
     } catch (IOException e) {
       throw new IllegalArgumentException("unable to serialize IteratorSetting");
@@ -608,7 +608,7 @@ public class InputConfigurator extends ConfiguratorBase {
     }
 
     String confKey = enumToConfKey(implementingClass, ScanOpts.TABLE_CONFIGS);
-    conf.set(confKey, new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8));
+    conf.set(confKey, Base64.getEncoder().encodeToString(baos.toByteArray()));
   }
 
   /**
@@ -630,7 +630,7 @@ public class InputConfigurator extends ConfiguratorBase {
     MapWritable mapWritable = new MapWritable();
     if (configString != null) {
       try {
-        byte[] bytes = Base64.getDecoder().decode(configString.getBytes(UTF_8));
+        byte[] bytes = Base64.getDecoder().decode(configString);
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         mapWritable.readFields(new DataInputStream(bais));
         bais.close();
@@ -950,11 +950,11 @@ public class InputConfigurator extends ConfiguratorBase {
       throw new RuntimeException(e);
     }
 
-    return new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8);
+    return Base64.getEncoder().encodeToString(baos.toByteArray());
   }
 
   private static <T extends Writable> T fromBase64(T writable, String enc) {
-    ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(enc.getBytes(UTF_8)));
+    ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(enc));
     DataInputStream dis = new DataInputStream(bais);
     try {
       writable.readFields(dis);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
index eb2b1aa..7a3c020 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
@@ -93,7 +93,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
             Scanner in = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), UTF_8)));
             try {
               while (in.hasNextLine())
-                cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine().getBytes(UTF_8))));
+                cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine())));
             } finally {
               in.close();
             }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
index 4e19472..94995cb 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.core.iterators.user;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.io.IOException;
 import java.util.Base64;
 import java.util.Collection;
@@ -390,7 +388,7 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value> {
   protected static String encodeColumns(Text[] columns) {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < columns.length; i++) {
-      sb.append(new String(Base64.getEncoder().encode(TextUtil.getBytes(columns[i])), UTF_8));
+      sb.append(Base64.getEncoder().encodeToString(TextUtil.getBytes(columns[i])));
       sb.append('\n');
     }
     return sb.toString();
@@ -407,14 +405,14 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value> {
       else
         bytes[i] = 0;
     }
-    return new String(Base64.getEncoder().encode(bytes), UTF_8);
+    return Base64.getEncoder().encodeToString(bytes);
   }
 
   protected static Text[] decodeColumns(String columns) {
     String[] columnStrings = columns.split("\n");
     Text[] columnTexts = new Text[columnStrings.length];
     for (int i = 0; i < columnStrings.length; i++) {
-      columnTexts[i] = new Text(Base64.getDecoder().decode(columnStrings[i].getBytes(UTF_8)));
+      columnTexts[i] = new Text(Base64.getDecoder().decode(columnStrings[i]));
     }
     return columnTexts;
   }
@@ -427,7 +425,7 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value> {
     if (flags == null)
       return null;
 
-    byte[] bytes = Base64.getDecoder().decode(flags.getBytes(UTF_8));
+    byte[] bytes = Base64.getDecoder().decode(flags);
     boolean[] bFlags = new boolean[bytes.length];
     for (int i = 0; i < bytes.length; i++) {
       if (bytes[i] == 1)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/rpc/SaslDigestCallbackHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/SaslDigestCallbackHandler.java b/core/src/main/java/org/apache/accumulo/core/rpc/SaslDigestCallbackHandler.java
index 901bec1..42914eb 100644
--- a/core/src/main/java/org/apache/accumulo/core/rpc/SaslDigestCallbackHandler.java
+++ b/core/src/main/java/org/apache/accumulo/core/rpc/SaslDigestCallbackHandler.java
@@ -16,9 +16,10 @@
  */
 package org.apache.accumulo.core.rpc;
 
+import java.util.Base64;
+
 import javax.security.auth.callback.CallbackHandler;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.security.token.SecretManager;
 import org.apache.hadoop.security.token.SecretManager.InvalidToken;
 import org.apache.hadoop.security.token.TokenIdentifier;
@@ -36,7 +37,7 @@ public abstract class SaslDigestCallbackHandler implements CallbackHandler {
    * @see #decodeIdentifier(String)
    */
   public String encodeIdentifier(byte[] identifier) {
-    return new String(Base64.encodeBase64(identifier));
+    return Base64.getEncoder().encodeToString(identifier);
   }
 
   /**
@@ -47,7 +48,7 @@ public abstract class SaslDigestCallbackHandler implements CallbackHandler {
    * @see #getPassword(SecretManager, TokenIdentifier)
    */
   public char[] encodePassword(byte[] password) {
-    return new String(Base64.encodeBase64(password)).toCharArray();
+    return Base64.getEncoder().encodeToString(password).toCharArray();
   }
 
   /**
@@ -71,7 +72,7 @@ public abstract class SaslDigestCallbackHandler implements CallbackHandler {
    * @see #encodeIdentifier(byte[])
    */
   public byte[] decodeIdentifier(String identifier) {
-    return Base64.decodeBase64(identifier.getBytes());
+    return Base64.getDecoder().decode(identifier);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
index 81a2784..9b7a41e 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
@@ -153,7 +153,7 @@ public class Authorizations implements Iterable<byte[]>, Serializable, Authoriza
       authsString = authsString.substring(HEADER.length());
       if (authsString.length() > 0) {
         for (String encAuth : authsString.split(",")) {
-          byte[] auth = Base64.getDecoder().decode(encAuth.getBytes(UTF_8));
+          byte[] auth = Base64.getDecoder().decode(encAuth);
           auths.add(new ArrayByteSequence(auth));
         }
         checkAuths();
@@ -340,7 +340,7 @@ public class Authorizations implements Iterable<byte[]>, Serializable, Authoriza
     for (byte[] auth : authsList) {
       sb.append(sep);
       sep = ",";
-      sb.append(new String(Base64.getEncoder().encode(auth), UTF_8));
+      sb.append(Base64.getEncoder().encodeToString(auth));
     }
 
     return sb.toString();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
index 15463bf..b63cdfd 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
@@ -24,8 +24,6 @@ import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Base64;
 
-import jline.console.ConsoleReader;
-
 import org.apache.accumulo.core.cli.ClientOpts.Password;
 import org.apache.accumulo.core.cli.ClientOpts.PasswordConverter;
 import org.apache.accumulo.core.cli.Help;
@@ -39,6 +37,8 @@ import org.apache.accumulo.start.spi.KeywordExecutable;
 import com.beust.jcommander.Parameter;
 import com.google.auto.service.AutoService;
 
+import jline.console.ConsoleReader;
+
 @AutoService(KeywordExecutable.class)
 public class CreateToken implements KeywordExecutable {
 
@@ -109,7 +109,7 @@ public class CreateToken implements KeywordExecutable {
         props.put(tp.getKey(), input);
         token.init(props);
       }
-      String tokenBase64 = new String(Base64.getEncoder().encode(AuthenticationTokenSerializer.serialize(token)), UTF_8);
+      String tokenBase64 = Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token));
 
       String tokenFile = opts.tokenFile;
       if (tokenFile == null) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/main/java/org/apache/accumulo/core/util/Encoding.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/Encoding.java b/core/src/main/java/org/apache/accumulo/core/util/Encoding.java
index f956651..c326136 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/Encoding.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/Encoding.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.core.util;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.util.Base64;
 
 import org.apache.hadoop.io.Text;
@@ -25,7 +23,7 @@ import org.apache.hadoop.io.Text;
 public class Encoding {
 
   public static String encodeAsBase64FileName(Text data) {
-    String encodedRow = new String(Base64.getUrlEncoder().encode(TextUtil.getBytes(data)), UTF_8);
+    String encodedRow = Base64.getUrlEncoder().encodeToString(TextUtil.getBytes(data));
 
     int index = encodedRow.length() - 1;
     while (index >= 0 && encodedRow.charAt(index) == '=')
@@ -36,7 +34,7 @@ public class Encoding {
   }
 
   public static byte[] decodeBase64FileName(String node) {
-    return Base64.getUrlDecoder().decode(node.getBytes(UTF_8));
+    return Base64.getUrlDecoder().decode(node);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
index 1034f42..3db8149 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.core.client.mapred;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -57,7 +56,7 @@ public class AccumuloInputFormatTest {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     is.write(new DataOutputStream(baos));
     String iterators = job.get("AccumuloInputFormat.ScanOpts.Iterators");
-    assertEquals(new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8), iterators);
+    assertEquals(Base64.getEncoder().encodeToString(baos.toByteArray()), iterators);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index f40a2c2..1cefc41 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.core.client.mapreduce;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -52,7 +51,7 @@ public class AccumuloInputFormatTest {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     is.write(new DataOutputStream(baos));
     String iterators = conf.get("AccumuloInputFormat.ScanOpts.Iterators");
-    assertEquals(new String(Base64.getEncoder().encode(baos.toByteArray()), UTF_8), iterators);
+    assertEquals(Base64.getEncoder().encodeToString(baos.toByteArray()), iterators);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
index 13b96c3..7b5ac26 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.core.client.mapreduce.lib.impl;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -66,7 +65,7 @@ public class ConfiguratorBaseTest {
     assertEquals(new PasswordToken("testPassword"), token);
     assertEquals(
         "inline:" + PasswordToken.class.getName() + ":"
-            + new String(Base64.getEncoder().encode(AuthenticationTokenSerializer.serialize(new PasswordToken("testPassword"))), UTF_8),
+            + Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(new PasswordToken("testPassword"))),
         conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.ConnectorInfo.TOKEN)));
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/examples/simple/pom.xml
----------------------------------------------------------------------
diff --git a/examples/simple/pom.xml b/examples/simple/pom.xml
index 0debf5c..95c4f0f 100644
--- a/examples/simple/pom.xml
+++ b/examples/simple/pom.xml
@@ -41,10 +41,6 @@
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
index 56dd9a2..42ec5ea 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.examples.simple.mapreduce.bulk;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.io.BufferedOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
@@ -135,7 +133,7 @@ public class BulkIngestExample extends Configured implements Tool {
 
       Collection<Text> splits = connector.tableOperations().listSplits(opts.getTableName(), 100);
       for (Text split : splits)
-        out.println(new String(Base64.getEncoder().encode(TextUtil.getBytes(split)), UTF_8));
+        out.println(Base64.getEncoder().encodeToString(TextUtil.getBytes(split)));
 
       job.setNumReduceTasks(splits.size() + 1);
       out.close();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/maven-plugin/src/it/plugin-test/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugin/src/it/plugin-test/pom.xml b/maven-plugin/src/it/plugin-test/pom.xml
index f114fa4..0cc0075 100644
--- a/maven-plugin/src/it/plugin-test/pom.xml
+++ b/maven-plugin/src/it/plugin-test/pom.xml
@@ -36,10 +36,6 @@
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
index 2fa606b..fbaa1d9 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.server.master.state;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -92,7 +90,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     try {
       Set<KeyExtent> result = new HashSet<KeyExtent>();
       DataInputBuffer buffer = new DataInputBuffer();
-      byte[] data = Base64.getDecoder().decode(migrations.getBytes(UTF_8));
+      byte[] data = Base64.getDecoder().decode(migrations);
       buffer.reset(data, data.length);
       while (buffer.available() > 0) {
         KeyExtent extent = new KeyExtent();
@@ -138,7 +136,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     try {
       Map<String,MergeInfo> result = new HashMap<String,MergeInfo>();
       DataInputBuffer buffer = new DataInputBuffer();
-      byte[] data = Base64.getDecoder().decode(merges.getBytes(UTF_8));
+      byte[] data = Base64.getDecoder().decode(merges);
       buffer.reset(data, data.length);
       while (buffer.available() > 0) {
         MergeInfo mergeInfo = new MergeInfo();
@@ -239,7 +237,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }
-    String encoded = new String(Base64.getEncoder().encode(Arrays.copyOf(buffer.getData(), buffer.getLength())), UTF_8);
+    String encoded = Base64.getEncoder().encodeToString(Arrays.copyOf(buffer.getData(), buffer.getLength()));
     cfg.addOption(MERGES_OPTION, encoded);
   }
 
@@ -252,7 +250,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }
-    String encoded = new String(Base64.getEncoder().encode(Arrays.copyOf(buffer.getData(), buffer.getLength())), UTF_8);
+    String encoded = Base64.getEncoder().encodeToString(Arrays.copyOf(buffer.getData(), buffer.getLength()));
     cfg.addOption(MIGRATIONS_OPTION, encoded);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java
index 054808c..504f291 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java
@@ -106,7 +106,7 @@ public class KerberosAuthenticator implements Authenticator {
         zoo.putPersistentData(zkUserPath, principalData, NodeExistsPolicy.FAIL);
 
         // Create the root user in ZK using base64 encoded name (since the name is included in the znode)
-        createUserNodeInZk(new String(Base64.getEncoder().encode(principalData), UTF_8));
+        createUserNodeInZk(Base64.getEncoder().encodeToString(principalData));
       }
     } catch (KeeperException | InterruptedException e) {
       log.error("Failed to initialize security", e);
@@ -144,7 +144,7 @@ public class KerberosAuthenticator implements Authenticator {
     Set<String> base64Users = zkAuthenticator.listUsers();
     Set<String> readableUsers = new HashSet<>();
     for (String base64User : base64Users) {
-      readableUsers.add(new String(Base64.getDecoder().decode(base64User.getBytes(UTF_8)), UTF_8));
+      readableUsers.add(new String(Base64.getDecoder().decode(base64User), UTF_8));
     }
     return readableUsers;
   }
@@ -156,7 +156,7 @@ public class KerberosAuthenticator implements Authenticator {
     }
 
     try {
-      createUserNodeInZk(new String(Base64.getEncoder().encode(principal.getBytes(UTF_8)), UTF_8));
+      createUserNodeInZk(Base64.getEncoder().encodeToString(principal.getBytes(UTF_8)));
     } catch (KeeperException e) {
       if (e.code().equals(KeeperException.Code.NODEEXISTS)) {
         throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_EXISTS, e);
@@ -171,7 +171,7 @@ public class KerberosAuthenticator implements Authenticator {
 
   @Override
   public synchronized void dropUser(String user) throws AccumuloSecurityException {
-    final String encodedUser = new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8);
+    final String encodedUser = Base64.getEncoder().encodeToString(user.getBytes(UTF_8));
     try {
       zkAuthenticator.dropUser(encodedUser);
     } catch (AccumuloSecurityException e) {
@@ -186,7 +186,7 @@ public class KerberosAuthenticator implements Authenticator {
 
   @Override
   public synchronized boolean userExists(String user) throws AccumuloSecurityException {
-    user = new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8);
+    user = Base64.getEncoder().encodeToString(user.getBytes(UTF_8));
     return zkAuthenticator.userExists(user);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthorizor.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthorizor.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthorizor.java
index 2b25dad..fe7e2e3 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthorizor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthorizor.java
@@ -50,32 +50,32 @@ public class KerberosAuthorizor implements Authorizor {
 
   @Override
   public void initializeSecurity(TCredentials credentials, String rootuser) throws AccumuloSecurityException, ThriftSecurityException {
-    zkAuthorizor.initializeSecurity(credentials, new String(Base64.getEncoder().encode(rootuser.getBytes(UTF_8)), UTF_8));
+    zkAuthorizor.initializeSecurity(credentials, Base64.getEncoder().encodeToString(rootuser.getBytes(UTF_8)));
   }
 
   @Override
   public void changeAuthorizations(String user, Authorizations authorizations) throws AccumuloSecurityException {
-    zkAuthorizor.changeAuthorizations(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), authorizations);
+    zkAuthorizor.changeAuthorizations(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), authorizations);
   }
 
   @Override
   public Authorizations getCachedUserAuthorizations(String user) throws AccumuloSecurityException {
-    return zkAuthorizor.getCachedUserAuthorizations(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8));
+    return zkAuthorizor.getCachedUserAuthorizations(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)));
   }
 
   @Override
   public boolean isValidAuthorizations(String user, List<ByteBuffer> list) throws AccumuloSecurityException {
-    return zkAuthorizor.isValidAuthorizations(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), list);
+    return zkAuthorizor.isValidAuthorizations(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), list);
   }
 
   @Override
   public void initUser(String user) throws AccumuloSecurityException {
-    zkAuthorizor.initUser(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8));
+    zkAuthorizor.initUser(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)));
   }
 
   @Override
   public void dropUser(String user) throws AccumuloSecurityException {
-    user = new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8);
+    user = Base64.getEncoder().encodeToString(user.getBytes(UTF_8));
     zkAuthorizor.dropUser(user);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosPermissionHandler.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosPermissionHandler.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosPermissionHandler.java
index 808088b..777b05d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosPermissionHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosPermissionHandler.java
@@ -52,71 +52,71 @@ public class KerberosPermissionHandler implements PermissionHandler {
 
   @Override
   public void initializeSecurity(TCredentials credentials, String rootuser) throws AccumuloSecurityException, ThriftSecurityException {
-    zkPermissionHandler.initializeSecurity(credentials, new String(Base64.getEncoder().encode(rootuser.getBytes(UTF_8)), UTF_8));
+    zkPermissionHandler.initializeSecurity(credentials, Base64.getEncoder().encodeToString(rootuser.getBytes(UTF_8)));
   }
 
   @Override
   public boolean hasSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    return zkPermissionHandler.hasSystemPermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), permission);
+    return zkPermissionHandler.hasSystemPermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), permission);
   }
 
   @Override
   public boolean hasCachedSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    return zkPermissionHandler.hasCachedSystemPermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), permission);
+    return zkPermissionHandler.hasCachedSystemPermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), permission);
   }
 
   @Override
   public boolean hasTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    return zkPermissionHandler.hasTablePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), table, permission);
+    return zkPermissionHandler.hasTablePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), table, permission);
   }
 
   @Override
   public boolean hasCachedTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    return zkPermissionHandler.hasCachedTablePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), table, permission);
+    return zkPermissionHandler.hasCachedTablePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), table, permission);
   }
 
   @Override
   public boolean hasNamespacePermission(String user, String namespace, NamespacePermission permission) throws AccumuloSecurityException,
       NamespaceNotFoundException {
-    return zkPermissionHandler.hasNamespacePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), namespace, permission);
+    return zkPermissionHandler.hasNamespacePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), namespace, permission);
   }
 
   @Override
   public boolean hasCachedNamespacePermission(String user, String namespace, NamespacePermission permission) throws AccumuloSecurityException,
       NamespaceNotFoundException {
-    return zkPermissionHandler.hasCachedNamespacePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), namespace, permission);
+    return zkPermissionHandler.hasCachedNamespacePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), namespace, permission);
   }
 
   @Override
   public void grantSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    zkPermissionHandler.grantSystemPermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), permission);
+    zkPermissionHandler.grantSystemPermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), permission);
   }
 
   @Override
   public void revokeSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    zkPermissionHandler.revokeSystemPermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), permission);
+    zkPermissionHandler.revokeSystemPermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), permission);
   }
 
   @Override
   public void grantTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    zkPermissionHandler.grantTablePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), table, permission);
+    zkPermissionHandler.grantTablePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), table, permission);
   }
 
   @Override
   public void revokeTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    zkPermissionHandler.revokeTablePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), table, permission);
+    zkPermissionHandler.revokeTablePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), table, permission);
   }
 
   @Override
   public void grantNamespacePermission(String user, String namespace, NamespacePermission permission) throws AccumuloSecurityException,
       NamespaceNotFoundException {
-    zkPermissionHandler.grantNamespacePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), namespace, permission);
+    zkPermissionHandler.grantNamespacePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), namespace, permission);
   }
 
   @Override
   public void revokeNamespacePermission(String user, String namespace, NamespacePermission permission) throws AccumuloSecurityException,
       NamespaceNotFoundException {
-    zkPermissionHandler.revokeNamespacePermission(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8), namespace, permission);
+    zkPermissionHandler.revokeNamespacePermission(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)), namespace, permission);
   }
 
   @Override
@@ -131,7 +131,7 @@ public class KerberosPermissionHandler implements PermissionHandler {
 
   @Override
   public void initUser(String user) throws AccumuloSecurityException {
-    zkPermissionHandler.initUser(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8));
+    zkPermissionHandler.initUser(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)));
   }
 
   @Override
@@ -141,7 +141,7 @@ public class KerberosPermissionHandler implements PermissionHandler {
 
   @Override
   public void cleanUser(String user) throws AccumuloSecurityException {
-    zkPermissionHandler.cleanUser(new String(Base64.getEncoder().encode(user.getBytes(UTF_8)), UTF_8));
+    zkPermissionHandler.cleanUser(Base64.getEncoder().encodeToString(user.getBytes(UTF_8)));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java b/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
index 6967658..5f6f704 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
@@ -109,7 +109,7 @@ public class DumpZookeeper {
     for (int i = 0; i < data.length; i++) {
       // does this look like simple ascii?
       if (data[i] < ' ' || data[i] > '~')
-        return new Encoded("base64", new String(Base64.getEncoder().encode(data), UTF_8));
+        return new Encoded("base64", Base64.getEncoder().encodeToString(data));
     }
     return new Encoded(UTF_8.name(), new String(data, UTF_8));
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
index c97f81b..33dbb18 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
@@ -120,7 +120,7 @@ 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.getEncoder().encode(directory.getBytes(UTF_8)), UTF_8);
+    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + Base64.getEncoder().encodeToString(directory.getBytes(UTF_8));
 
     IZooReaderWriter zk = ZooReaderWriter.getInstance();
 
@@ -132,7 +132,7 @@ 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.getEncoder().encode(directory.getBytes(UTF_8)), UTF_8);
+    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + Base64.getEncoder().encodeToString(directory.getBytes(UTF_8));
     ZooReservation.release(ZooReaderWriter.getInstance(), resvPath, String.format("%016x", tid));
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/monitor/pom.xml
----------------------------------------------------------------------
diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml
index 73469bb..8db93a1 100644
--- a/server/monitor/pom.xml
+++ b/server/monitor/pom.xml
@@ -41,10 +41,6 @@
       <artifactId>guava</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
index a281d51..1bd5ceb 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.monitor.servlets;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.lang.management.ManagementFactory;
 import java.security.MessageDigest;
 import java.text.DateFormat;
@@ -173,7 +171,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.getEncoder().encode(digester.digest()), UTF_8);
+      String obscuredExtent = Base64.getEncoder().encodeToString(digester.digest());
       String displayExtent = String.format("<code>[%s]</code>", obscuredExtent);
 
       TableRow row = perTabletResults.prepareRow();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/shell/pom.xml
----------------------------------------------------------------------
diff --git a/shell/pom.xml b/shell/pom.xml
index 77f9261..3ad85d6 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -48,10 +48,6 @@
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java b/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
index 871dc79..0cdaf18 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
@@ -49,7 +49,7 @@ public class ShellUtil {
       while (file.hasNextLine()) {
         line = file.nextLine();
         if (!line.isEmpty()) {
-          result.add(decode ? new Text(Base64.getDecoder().decode(line.getBytes(UTF_8))) : new Text(line));
+          result.add(decode ? new Text(Base64.getDecoder().decode(line)) : new Text(line));
         }
       }
     } finally {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
index ee39c7c..5930498 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
@@ -86,7 +86,7 @@ public class FateCommand extends Command {
 
     ByteArrayContainer(byte[] ba) {
       asUtf8 = new String(ba, UTF_8);
-      asBase64 = new String(Base64.getUrlEncoder().encode(ba), UTF_8);
+      asBase64 = Base64.getUrlEncoder().encodeToString(ba);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
index 4997242..cae7af2 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.shell.commands;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.io.IOException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -105,8 +103,7 @@ public class GetSplitsCommand extends Command {
       return null;
     }
     final int length = text.getLength();
-    return encode ? new String(Base64.getEncoder().encode(TextUtil.getBytes(text)), UTF_8) : DefaultFormatter.appendText(new StringBuilder(), text, length)
-        .toString();
+    return encode ? Base64.getEncoder().encodeToString(TextUtil.getBytes(text)) : DefaultFormatter.appendText(new StringBuilder(), text, length).toString();
   }
 
   private static String obscuredTabletName(final KeyExtent extent) {
@@ -119,7 +116,7 @@ public class GetSplitsCommand extends Command {
     if (extent.getEndRow() != null && extent.getEndRow().getLength() > 0) {
       digester.update(extent.getEndRow().getBytes(), 0, extent.getEndRow().getLength());
     }
-    return new String(Base64.getEncoder().encode(digester.digest()), UTF_8);
+    return Base64.getEncoder().encodeToString(digester.digest());
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/shell/src/main/java/org/apache/accumulo/shell/commands/HiddenCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/HiddenCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/HiddenCommand.java
index d278913..4098f67 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/HiddenCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/HiddenCommand.java
@@ -43,9 +43,9 @@ public class HiddenCommand extends Command {
       shellState.getReader().println();
       shellState.getReader().println(
           new String(Base64.getDecoder().decode(
-              ("ICAgICAgIC4tLS4KICAgICAgLyAvXCBcCiAgICAgKCAvLS1cICkKICAgICAuPl8gIF88LgogICAgLyB8ICd8ICcgXAog"
+              "ICAgICAgIC4tLS4KICAgICAgLyAvXCBcCiAgICAgKCAvLS1cICkKICAgICAuPl8gIF88LgogICAgLyB8ICd8ICcgXAog"
                   + "ICAvICB8Xy58Xy4gIFwKICAvIC98ICAgICAgfFwgXAogfCB8IHwgfFwvfCB8IHwgfAogfF98IHwgfCAgfCB8IHxffAogICAgIC8gIF9fICBcCiAgICAvICAv"
-                  + "ICBcICBcCiAgIC8gIC8gICAgXCAgXF8KIHwvICAvICAgICAgXCB8IHwKIHxfXy8gICAgICAgIFx8X3wK").getBytes(UTF_8)), UTF_8));
+                  + "ICBcICBcCiAgIC8gIC8gICAgXCAgXF8KIHwvICAvICAgICAgXCB8IHwKIHxfXy8gICAgICAgIFx8X3wK"), UTF_8));
     } else {
       throw new ShellCommandException(ErrorCode.UNRECOGNIZED_COMMAND, getName());
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java
index c95a7d6..96d57c4 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java
@@ -173,7 +173,7 @@ public class BulkInsert extends Test {
 
     Collection<Text> splits = conn.tableOperations().listSplits(tableName, maxSplits);
     for (Text split : splits)
-      out.println(new String(Base64.getEncoder().encode(TextUtil.getBytes(split)), UTF_8));
+      out.println(Base64.getEncoder().encodeToString(TextUtil.getBytes(split)));
 
     out.close();
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java b/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
index ced5940..0d5d466 100644
--- a/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
+++ b/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.test.util;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
@@ -72,21 +70,21 @@ public class SerializationUtil {
 
   public static String serializeWritableBase64(Writable writable) {
     byte[] b = serializeWritable(writable);
-    return new String(Base64.getEncoder().encode(b), UTF_8);
+    return Base64.getEncoder().encodeToString(b);
   }
 
   public static void deserializeWritableBase64(Writable writable, String str) {
-    byte[] b = Base64.getDecoder().decode(str.getBytes(UTF_8));
+    byte[] b = Base64.getDecoder().decode(str);
     deserializeWritable(writable, b);
   }
 
   public static String serializeBase64(Serializable obj) {
     byte[] b = serialize(obj);
-    return new String(Base64.getEncoder().encode(b), UTF_8);
+    return Base64.getEncoder().encodeToString(b);
   }
 
   public static Object deserializeBase64(String str) {
-    byte[] b = Base64.getDecoder().decode(str.getBytes(UTF_8));
+    byte[] b = Base64.getDecoder().decode(str);
     return deserialize(b);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a6ecb7a4/test/src/test/java/org/apache/accumulo/test/TraceRepoDeserializationTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TraceRepoDeserializationTest.java b/test/src/test/java/org/apache/accumulo/test/TraceRepoDeserializationTest.java
index 71c50ea..4bf983e 100644
--- a/test/src/test/java/org/apache/accumulo/test/TraceRepoDeserializationTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/TraceRepoDeserializationTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.test;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
@@ -40,7 +39,7 @@ public class TraceRepoDeserializationTest {
 
   @Test(expected = InvalidClassException.class)
   public void test() throws Exception {
-    byte bytes[] = Base64.getDecoder().decode(oldValue.getBytes(UTF_8));
+    byte bytes[] = Base64.getDecoder().decode(oldValue);
     ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     ObjectInputStream ois = new ObjectInputStream(bais);
     ois.readObject();


Mime
View raw message