accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [06/16] accumulo git commit: ACCUMULO-4046 Apply changes identified by modernizer
Date Wed, 03 Feb 2016 17:53:59 GMT
ACCUMULO-4046 Apply changes identified by modernizer

* Applies all modernizer changes to 1.6 branch (jdk 1.6 recommendations)
* Re-run findbugs (with jdk 1.7, findbugs 3.0.3) and fix recommendations


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

Branch: refs/heads/master
Commit: f49fe539f75db49196792e71dd067eeb64109696
Parents: a9482a9
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Tue Feb 2 23:39:20 2016 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Tue Feb 2 23:39:20 2016 -0500

----------------------------------------------------------------------
 .../core/iterators/user/RegExFilter.java        | 31 ++++++---------
 .../core/security/VisibilityConstraint.java     |  4 +-
 .../security/crypto/DefaultCryptoModule.java    | 10 ++---
 .../apache/accumulo/core/util/shell/Shell.java  |  8 ++--
 .../core/util/shell/commands/TraceCommand.java  |  6 +--
 .../simple/constraints/MaxMutationSize.java     |  2 +-
 .../simple/filedata/ChunkInputStreamTest.java   | 40 ++++++++++++--------
 .../impl/MiniAccumuloClusterControl.java        |  2 +-
 .../master/balancer/TableLoadBalancerTest.java  |  6 +--
 .../accumulo/server/util/DefaultMapTest.java    |  4 +-
 .../accumulo/master/tableOps/BulkImport.java    |  2 +-
 .../monitor/servlets/TablesServlet.java         |  2 +-
 .../apache/accumulo/tserver/TabletServer.java   |  2 +-
 .../org/apache/accumulo/test/BalanceIT.java     |  2 +-
 .../accumulo/test/ConditionalWriterIT.java      |  2 +-
 .../test/TracerRecoversAfterOfflineTableIT.java |  2 +-
 .../test/functional/FunctionalTestUtils.java    |  2 +-
 .../trace/instrument/PerformanceTest.java       |  3 +-
 18 files changed, 66 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
index 5706dd0..ba224ee 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
@@ -19,7 +19,8 @@ package org.apache.accumulo.core.iterators.user;
 import static com.google.common.base.Charsets.UTF_8;
 
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -65,7 +66,7 @@ public class RegExFilter extends Filter {
   private boolean orFields = false;
   private boolean matchSubstring = false;
 
-  private String encoding = ENCODING_DEFAULT;
+  private Charset encoding = Charset.forName(ENCODING_DEFAULT);
 
   private Matcher copyMatcher(Matcher m) {
     if (m == null)
@@ -76,24 +77,16 @@ public class RegExFilter extends Filter {
 
   private boolean matches(Matcher matcher, ByteSequence bs) {
     if (matcher != null) {
-      try {
-        matcher.reset(new String(bs.getBackingArray(), bs.offset(), bs.length(), encoding));
-        return matchSubstring ? matcher.find() : matcher.matches();
-      } catch (UnsupportedEncodingException e) {
-        e.printStackTrace();
-      }
+      matcher.reset(new String(bs.getBackingArray(), bs.offset(), bs.length(), encoding));
+      return matchSubstring ? matcher.find() : matcher.matches();
     }
     return !orFields;
   }
 
   private boolean matches(Matcher matcher, byte data[], int offset, int len) {
     if (matcher != null) {
-      try {
-        matcher.reset(new String(data, offset, len, encoding));
-        return matchSubstring ? matcher.find() : matcher.matches();
-      } catch (UnsupportedEncodingException e) {
-        e.printStackTrace();
-      }
+      matcher.reset(new String(data, offset, len, encoding));
+      return matchSubstring ? matcher.find() : matcher.matches();
     }
     return !orFields;
   }
@@ -149,7 +142,7 @@ public class RegExFilter extends Filter {
     }
 
     if (options.containsKey(ENCODING)) {
-      encoding = options.get(ENCODING);
+      encoding = Charset.forName(options.get(ENCODING));
     }
   }
 
@@ -191,11 +184,9 @@ public class RegExFilter extends Filter {
 
     if (options.containsKey(ENCODING)) {
       try {
-        this.encoding = options.get(ENCODING);
-        if ("".equals(this.encoding))
-          encoding = ENCODING_DEFAULT;
-        new String("test".getBytes(UTF_8), encoding);
-      } catch (UnsupportedEncodingException e) {
+        String encodingOpt = options.get(ENCODING);
+        this.encoding = Charset.forName(encodingOpt.isEmpty() ? ENCODING_DEFAULT : encodingOpt);
+      } catch (UnsupportedCharsetException e) {
         throw new IllegalArgumentException("invalid encoding " + ENCODING + ":" + this.encoding,
e);
       }
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java
b/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java
index d9d13d7..4b3d269 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java
@@ -75,9 +75,9 @@ public class VisibilityConstraint implements Constraint {
             return Collections.singletonList(Short.valueOf((short) 2));
 
         } catch (BadArgumentException bae) {
-          return Collections.singletonList(new Short((short) 1));
+          return Collections.singletonList(Short.valueOf((short) 1));
         } catch (VisibilityParseException e) {
-          return Collections.singletonList(new Short((short) 1));
+          return Collections.singletonList(Short.valueOf((short) 1));
         }
 
         if (ok != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
index c0eded3..a356877 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
@@ -107,7 +107,7 @@ public class DefaultCryptoModule implements CryptoModule {
     return cipherSuite.split("/");
   }
 
-  private boolean validateNotEmpty(String givenValue, boolean allIsWell, StringBuffer buf,
String errorMessage) {
+  private boolean validateNotEmpty(String givenValue, boolean allIsWell, StringBuilder buf,
String errorMessage) {
     if (givenValue == null || givenValue.equals("")) {
       buf.append(errorMessage);
       buf.append("\n");
@@ -117,7 +117,7 @@ public class DefaultCryptoModule implements CryptoModule {
     return true && allIsWell;
   }
 
-  private boolean validateNotNull(Object givenValue, boolean allIsWell, StringBuffer buf,
String errorMessage) {
+  private boolean validateNotNull(Object givenValue, boolean allIsWell, StringBuilder buf,
String errorMessage) {
     if (givenValue == null) {
       buf.append(errorMessage);
       buf.append("\n");
@@ -127,7 +127,7 @@ public class DefaultCryptoModule implements CryptoModule {
     return true && allIsWell;
   }
 
-  private boolean validateNotZero(int givenValue, boolean allIsWell, StringBuffer buf, String
errorMessage) {
+  private boolean validateNotZero(int givenValue, boolean allIsWell, StringBuilder buf, String
errorMessage) {
     if (givenValue == 0) {
       buf.append(errorMessage);
       buf.append("\n");
@@ -141,7 +141,7 @@ public class DefaultCryptoModule implements CryptoModule {
 
     if (cipherMode == Cipher.ENCRYPT_MODE) {
 
-      StringBuffer errorBuf = new StringBuffer(
+      StringBuilder errorBuf = new StringBuilder(
           "The following problems were found with the CryptoModuleParameters object you provided
for an encrypt operation:\n");
       boolean allIsWell = true;
 
@@ -167,7 +167,7 @@ public class DefaultCryptoModule implements CryptoModule {
       return allIsWell;
 
     } else if (cipherMode == Cipher.DECRYPT_MODE) {
-      StringBuffer errorBuf = new StringBuffer(
+      StringBuilder errorBuf = new StringBuilder(
           "The following problems were found with the CryptoModuleParameters object you provided
for a decrypt operation:\n");
       boolean allIsWell = true;
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
index 66dd7b2..9231c78 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.net.InetAddress;
+import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -175,6 +176,7 @@ import org.apache.log4j.Logger;
 
 import com.beust.jcommander.JCommander;
 import com.beust.jcommander.ParameterException;
+import com.google.common.base.Charsets;
 
 import jline.console.ConsoleReader;
 import jline.console.UserInterruptException;
@@ -187,7 +189,7 @@ public class Shell extends ShellOptions {
   public static final Logger log = Logger.getLogger(Shell.class);
   private static final Logger audit = Logger.getLogger(Shell.class.getName() + ".audit");
 
-  public static final String CHARSET = "ISO-8859-1";
+  public static final Charset CHARSET = Charsets.ISO_8859_1;
   public static final int NO_FIXED_ARG_LENGTH_CHECK = -1;
   public static final String COMMENT_PREFIX = "#";
   public static final String HISTORY_DIR_NAME = ".accumulo";
@@ -228,8 +230,8 @@ public class Shell extends ShellOptions {
   private boolean masking = false;
 
   public Shell() throws IOException {
-    this(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, System.getProperty("jline.WindowsTerminal.output.encoding",
-        System.getProperty("file.encoding")))));
+    this(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
+        System.getProperty("file.encoding"))))));
   }
 
   public Shell(ConsoleReader reader, PrintWriter writer) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
index 67724f9..cacbe9f 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
@@ -42,10 +42,10 @@ public class TraceCommand extends DebugCommand {
         if (Trace.isTracing()) {
           final long trace = Trace.currentTrace().traceId();
           Trace.off();
-          StringBuffer sb = new StringBuffer();
+          StringBuilder sb = new StringBuilder();
           int traceCount = 0;
           for (int i = 0; i < 30; i++) {
-            sb = new StringBuffer();
+            sb = new StringBuilder();
             try {
               final Map<String,String> properties = shellState.getConnector().instanceOperations().getSystemConfiguration();
               final String table = properties.get(Property.TRACE_TABLE.getKey());
@@ -53,7 +53,7 @@ public class TraceCommand extends DebugCommand {
               final Authorizations auths = shellState.getConnector().securityOperations().getUserAuthorizations(user);
               final Scanner scanner = shellState.getConnector().createScanner(table, auths);
               scanner.setRange(new Range(new Text(Long.toHexString(trace))));
-              final StringBuffer finalSB = sb;
+              final StringBuilder finalSB = sb;
               traceCount = TraceDump.printTrace(scanner, new Printer() {
                 @Override
                 public void print(final String line) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/examples/simple/src/main/java/org/apache/accumulo/examples/simple/constraints/MaxMutationSize.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/constraints/MaxMutationSize.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/constraints/MaxMutationSize.java
index 1192549..3d94861 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/constraints/MaxMutationSize.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/constraints/MaxMutationSize.java
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.data.Mutation;
 public class MaxMutationSize implements Constraint {
   static final long MAX_SIZE = Runtime.getRuntime().maxMemory() >> 8;
   static final List<Short> empty = Collections.emptyList();
-  static final List<Short> violations = Collections.singletonList(new Short((short)
0));
+  static final List<Short> violations = Collections.singletonList(Short.valueOf((short)
0));
 
   @Override
   public String getViolationDescription(short violationCode) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
index 68af6d8..1c9afcf 100644
--- a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
+++ b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
@@ -16,13 +16,15 @@
  */
 package org.apache.accumulo.examples.simple.filedata;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map.Entry;
 
-import junit.framework.TestCase;
-
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
@@ -42,8 +44,9 @@ import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.util.PeekingIterator;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
+import org.junit.Test;
 
-public class ChunkInputStreamTest extends TestCase {
+public class ChunkInputStreamTest {
   private static final Logger log = Logger.getLogger(ChunkInputStream.class);
   List<Entry<Key,Value>> data;
   List<Entry<Key,Value>> baddata;
@@ -103,6 +106,7 @@ public class ChunkInputStreamTest extends TestCase {
     data.add(new KeyValue(new Key(new Text(row), new Text(cf), chunkCQ, new Text(vis)), value.getBytes()));
   }
 
+  @Test
   public void testExceptionOnMultipleSetSourceWithoutClose() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     PeekingIterator<Entry<Key,Value>> pi = new PeekingIterator<Entry<Key,Value>>(data.iterator());
@@ -110,13 +114,14 @@ public class ChunkInputStreamTest extends TestCase {
     cis.setSource(pi);
     try {
       cis.setSource(pi);
-      assertNotNull(null);
+      fail();
     } catch (IOException e) {
-      assertNull(null);
+      /* expected */
     }
     cis.close();
   }
 
+  @Test
   public void testExceptionOnGetVisBeforeClose() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     PeekingIterator<Entry<Key,Value>> pi = new PeekingIterator<Entry<Key,Value>>(data.iterator());
@@ -124,14 +129,15 @@ public class ChunkInputStreamTest extends TestCase {
     cis.setSource(pi);
     try {
       cis.getVisibilities();
-      assertNotNull(null);
+      fail();
     } catch (RuntimeException e) {
-      assertNull(null);
+      /* expected */
     }
     cis.close();
     cis.getVisibilities();
   }
 
+  @Test
   public void testReadIntoBufferSmallerThanChunks() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     byte[] b = new byte[5];
@@ -183,6 +189,7 @@ public class ChunkInputStreamTest extends TestCase {
     assertFalse(pi.hasNext());
   }
 
+  @Test
   public void testReadIntoBufferLargerThanChunks() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     byte[] b = new byte[20];
@@ -221,6 +228,7 @@ public class ChunkInputStreamTest extends TestCase {
     assertFalse(pi.hasNext());
   }
 
+  @Test
   public void testWithAccumulo() throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException {
     Connector conn = new MockInstance().getConnector("root", new PasswordToken(""));
     conn.tableOperations().create("test");
@@ -276,23 +284,22 @@ public class ChunkInputStreamTest extends TestCase {
   private static void assumeExceptionOnRead(ChunkInputStream cis, byte[] b) {
     try {
       cis.read(b);
-      assertNotNull(null);
+      fail();
     } catch (IOException e) {
       log.debug("EXCEPTION " + e.getMessage());
-      assertNull(null);
     }
   }
 
   private static void assumeExceptionOnClose(ChunkInputStream cis) {
     try {
       cis.close();
-      assertNotNull(null);
+      fail();
     } catch (IOException e) {
       log.debug("EXCEPTION " + e.getMessage());
-      assertNull(null);
     }
   }
 
+  @Test
   public void testBadData() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     byte[] b = new byte[20];
@@ -329,9 +336,9 @@ public class ChunkInputStreamTest extends TestCase {
 
     try {
       cis.setSource(pi);
-      assertNotNull(null);
+      fail();
     } catch (IOException e) {
-      assertNull(null);
+      /* expected */
     }
     assumeExceptionOnClose(cis);
     assertEquals(cis.getVisibilities().toString(), "[K]");
@@ -348,6 +355,7 @@ public class ChunkInputStreamTest extends TestCase {
     assumeExceptionOnClose(cis);
   }
 
+  @Test
   public void testBadDataWithoutClosing() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     byte[] b = new byte[20];
@@ -380,9 +388,9 @@ public class ChunkInputStreamTest extends TestCase {
 
     try {
       cis.setSource(pi);
-      assertNotNull(null);
+      fail();
     } catch (IOException e) {
-      assertNull(null);
+      /* expected */
     }
     assertEquals(cis.getVisibilities().toString(), "[K]");
 
@@ -398,6 +406,7 @@ public class ChunkInputStreamTest extends TestCase {
     assumeExceptionOnClose(cis);
   }
 
+  @Test
   public void testMultipleChunkSizes() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     byte[] b = new byte[20];
@@ -426,6 +435,7 @@ public class ChunkInputStreamTest extends TestCase {
     assertFalse(pi.hasNext());
   }
 
+  @Test
   public void testSingleByteRead() throws IOException {
     ChunkInputStream cis = new ChunkInputStream();
     PeekingIterator<Entry<Key,Value>> pi = new PeekingIterator<Entry<Key,Value>>(data.iterator());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
index fee0016..da526cf 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
@@ -100,7 +100,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
 
   private String readAll(InputStream is) throws IOException {
     byte[] buffer = new byte[4096];
-    StringBuffer result = new StringBuffer();
+    StringBuilder result = new StringBuilder();
     while (true) {
       int n = is.read(buffer);
       if (n <= 0)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
----------------------------------------------------------------------
diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
index 4681341..5e3d741 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
@@ -149,9 +149,9 @@ public class TableLoadBalancerTest {
     tls.balance(state, migrations, migrationsOut);
     int count = 0;
     Map<String,Integer> movedByTable = new HashMap<String,Integer>();
-    movedByTable.put(t1Id, new Integer(0));
-    movedByTable.put(t2Id, new Integer(0));
-    movedByTable.put(t3Id, new Integer(0));
+    movedByTable.put(t1Id, Integer.valueOf(0));
+    movedByTable.put(t2Id, Integer.valueOf(0));
+    movedByTable.put(t3Id, Integer.valueOf(0));
     for (TabletMigration migration : migrationsOut) {
       if (migration.oldServer.equals(svr))
         count++;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/server/base/src/test/java/org/apache/accumulo/server/util/DefaultMapTest.java
----------------------------------------------------------------------
diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/DefaultMapTest.java
b/server/base/src/test/java/org/apache/accumulo/server/util/DefaultMapTest.java
index 3303d8a..9ca2596 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/util/DefaultMapTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/util/DefaultMapTest.java
@@ -29,10 +29,10 @@ public class DefaultMapTest {
   public void testDefaultMap() {
     Integer value = new DefaultMap<String,Integer>(0).get("test");
     assertNotNull(value);
-    assertEquals(new Integer(0), value);
+    assertEquals(Integer.valueOf(0), value);
     value = new DefaultMap<String,Integer>(1).get("test");
     assertNotNull(value);
-    assertEquals(new Integer(1), value);
+    assertEquals(Integer.valueOf(1), value);
 
     AtomicInteger canConstruct = new DefaultMap<String,AtomicInteger>(new AtomicInteger(1)).get("test");
     assertNotNull(canConstruct);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
index 37edbc9..27955be 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
@@ -598,7 +598,7 @@ class LoadFiles extends MasterRepo {
   }
 
   static String sampleList(Collection<?> potentiallyLongList, int max) {
-    StringBuffer result = new StringBuffer();
+    StringBuilder result = new StringBuilder();
     result.append("[");
     int i = 0;
     for (Object obj : potentiallyLongList) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
index 224ba91..1446a3c 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
@@ -123,7 +123,7 @@ public class TablesServlet extends BasicServlet {
       TableInfo tableInfo = tableStats.get(tableName);
       Double holdTime = compactingByTable.get(tableId);
       if (holdTime == null)
-        holdTime = new Double(0.);
+        holdTime = Double.valueOf(0.);
       TableRow row = tableList.prepareRow();
       row.add(tableId);
       row.add(tableManager.getTableState(tableId));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 6023ae3..f3748d7 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -399,7 +399,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     private long maxIdle;
     private long maxUpdateIdle;
     private List<Session> idleSessions = new ArrayList<Session>();
-    private final Long expiredSessionMarker = new Long(-1);
+    private final Long expiredSessionMarker = Long.valueOf(-1);
 
     SessionManager(AccumuloConfiguration conf) {
       random = new SecureRandom();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/test/src/test/java/org/apache/accumulo/test/BalanceIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceIT.java
index c245e78..da72a04 100644
--- a/test/src/test/java/org/apache/accumulo/test/BalanceIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BalanceIT.java
@@ -68,7 +68,7 @@ public class BalanceIT extends ConfigurableMacIT {
       String host = entry.getKey().getColumnQualifier().toString();
       Integer count = counts.get(host);
       if (count == null) {
-        count = new Integer(0);
+        count = Integer.valueOf(0);
       }
       counts.put(host, count.intValue() + 1);
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 1579b34..69cfb72 100644
--- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -1400,7 +1400,7 @@ public class ConditionalWriterIT extends AccumuloClusterIT {
     final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
     scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
     loop: while (true) {
-      final StringBuffer finalBuffer = new StringBuffer();
+      final StringBuilder finalBuffer = new StringBuilder();
       int traceCount = TraceDump.printTrace(scanner, new Printer() {
         @Override
         public void print(final String line) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/test/src/test/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
b/test/src/test/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
index dbee101..0fe760c 100644
--- a/test/src/test/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
@@ -92,7 +92,7 @@ public class TracerRecoversAfterOfflineTableIT extends ConfigurableMacIT
{
     final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
     scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
     while (true) {
-      final StringBuffer finalBuffer = new StringBuffer();
+      final StringBuilder finalBuffer = new StringBuilder();
       int traceCount = TraceDump.printTrace(scanner, new Printer() {
         @Override
         public void print(final String line) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 4582f68..9199765 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -138,7 +138,7 @@ public class FunctionalTestUtils {
 
   static public String readAll(InputStream is) throws IOException {
     byte[] buffer = new byte[4096];
-    StringBuffer result = new StringBuffer();
+    StringBuilder result = new StringBuilder();
     while (true) {
       int n = is.read(buffer);
       if (n <= 0)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f49fe539/trace/src/test/java/org/apache/accumulo/trace/instrument/PerformanceTest.java
----------------------------------------------------------------------
diff --git a/trace/src/test/java/org/apache/accumulo/trace/instrument/PerformanceTest.java
b/trace/src/test/java/org/apache/accumulo/trace/instrument/PerformanceTest.java
index 481672d..0b444fa 100644
--- a/trace/src/test/java/org/apache/accumulo/trace/instrument/PerformanceTest.java
+++ b/trace/src/test/java/org/apache/accumulo/trace/instrument/PerformanceTest.java
@@ -29,8 +29,7 @@ public class PerformanceTest {
 
     long now = System.currentTimeMillis();
     for (long i = 0; i < 1000 * 1000; i++) {
-      @SuppressWarnings("unused")
-      Long x = new Long(i);
+      Long.valueOf(i);
     }
     System.out.println(String.format("Trivial took %d millis", System.currentTimeMillis()
- now));
     now = System.currentTimeMillis();


Mime
View raw message