You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2019/11/14 18:26:38 UTC

[accumulo] branch master updated: Enforce static imports for StandardCharsets

This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ab3403  Enforce static imports for StandardCharsets
5ab3403 is described below

commit 5ab3403263592131c144c52c5d830f52e823e9fc
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Thu Nov 14 13:24:04 2019 -0500

    Enforce static imports for StandardCharsets
    
    * Following up from PR #1425, adding enforcement of static imports for
      StandardCharsets, for consistency, in a checkstyle rule
    * Also as follow-up from that PR, update a Value instance to use String
      instead of byte[] in a test
---
 pom.xml                                                               | 4 ++++
 .../src/test/java/org/apache/accumulo/tserver/MemValueTest.java       | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 020ad60..7f81b32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1170,6 +1170,10 @@
                   <property name="format" value="import org[.]junit[.]Assert;" />
                   <property name="message" value="Use static imports for Assert.* methods for consistency" />
                 </module>
+                <module name="RegexpSinglelineJava">
+                  <property name="format" value="import java[.]nio[.]charset[.]StandardCharsets;" />
+                  <property name="message" value="Use static imports for StandardCharsets.* constants for consistency" />
+                </module>
                 <module name="OuterTypeFilename" />
                 <module name="AvoidStarImport" />
                 <module name="NoLineWrap" />
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/MemValueTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/MemValueTest.java
index 389a209..c6ced98 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/MemValueTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/MemValueTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.tserver;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.accumulo.core.data.Value;
@@ -26,7 +25,7 @@ public class MemValueTest {
 
   @Test
   public void testDecodeDoesntModifyInputValue() {
-    Value v = new Value("2.0".getBytes(UTF_8));
+    Value v = new Value("2.0");
     Value encodedValue = MemValue.encode(v, 3);
     MemValue m1 = MemValue.decode(encodedValue);
     MemValue m2 = MemValue.decode(encodedValue);