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 2020/01/30 20:41:37 UTC

[accumulo] branch 1.9 updated: Fix unused var and generics warning

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

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


The following commit(s) were added to refs/heads/1.9 by this push:
     new da198ba  Fix unused var and generics warning
da198ba is described below

commit da198ba40508babe01e6d04b07d77f2478a464df
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Thu Jan 30 13:19:11 2020 -0500

    Fix unused var and generics warning
---
 .../main/java/org/apache/accumulo/core/conf/PropertyType.java  | 10 ++++------
 .../java/org/apache/accumulo/test/functional/CloneTestIT.java  |  4 +---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
index 163c300..e84586f 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
@@ -24,6 +24,7 @@ import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Stream;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.util.Pair;
@@ -68,7 +69,9 @@ public enum PropertyType {
           + " 'localhost:2000,www.example.com,10.10.1.1:500' and 'localhost'.\n"
           + "Examples of invalid host lists are '', ':1000', and 'localhost:80000'"),
 
-  PORT("port", or(new Bounds(1024, 65535), in(true, "0"), new PortRange("\\d{4,5}-\\d{4,5}")),
+  PORT("port",
+      x -> Stream.of(new Bounds(1024, 65535), in(true, "0"), new PortRange("\\d{4,5}-\\d{4,5}"))
+          .anyMatch(y -> y.test(x)),
       "An positive integer in the range 1024-65535 (not already in use or"
           + " specified elsewhere in the configuration),\n"
           + "zero to indicate any open ephemeral port, or a range of positive"
@@ -159,11 +162,6 @@ public enum PropertyType {
     return predicate.test(value);
   }
 
-  @SuppressWarnings("unchecked")
-  private static Predicate<String> or(final Predicate<String>... others) {
-    return (x) -> Arrays.stream(others).anyMatch(y -> y.test(x));
-  }
-
   private static Predicate<String> in(final boolean caseSensitive, final String... allowedSet) {
     if (caseSensitive) {
       return x -> Arrays.stream(allowedSet)
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
index d072365..0d88f7f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
@@ -288,12 +288,10 @@ public class CloneTestIT extends AccumuloClusterHarness {
     Connector c = getConnector();
     AccumuloCluster cluster = getCluster();
     Assume.assumeTrue(cluster instanceof MiniAccumuloClusterImpl);
-    MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
-    String rootPath = mac.getConfig().getDir().getAbsolutePath();
 
     c.tableOperations().create(table1);
 
-    BatchWriter bw = writeData(table1, c);
+    writeData(table1, c);
 
     Map<String,String> props = new HashMap<>();
     props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K");