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 2022/07/25 18:26:58 UTC

[accumulo] branch main updated: Fix warnings

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 7e487dfdbf Fix warnings
7e487dfdbf is described below

commit 7e487dfdbff200df71a7e034371d469a10033d1f
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Mon Jul 25 14:26:48 2022 -0400

    Fix warnings
    
    * Use fully-qualified class name and warnings suppressions for
      ScanInterpreter uses left from #2806
    * Delete unused static get method in ZooInfoViewer introduced in #2751
---
 .../org/apache/accumulo/core/conf/Property.java    |  4 +-
 .../accumulo/server/conf/util/ZooInfoViewer.java   |  7 ---
 .../main/java/org/apache/accumulo/shell/Shell.java |  4 +-
 .../accumulo/shell/commands/DeleteManyCommand.java |  4 +-
 .../accumulo/shell/commands/GrepCommand.java       |  4 +-
 .../accumulo/shell/commands/MaxRowCommand.java     |  4 +-
 .../accumulo/shell/commands/ScanCommand.java       | 72 +++++++++++++---------
 7 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 100d8f4c69..9b252449c0 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -40,7 +40,6 @@ import org.apache.accumulo.core.spi.scan.ScanDispatcher;
 import org.apache.accumulo.core.spi.scan.ScanPrioritizer;
 import org.apache.accumulo.core.spi.scan.SimpleScanDispatcher;
 import org.apache.accumulo.core.util.format.DefaultFormatter;
-import org.apache.accumulo.core.util.interpret.DefaultScanInterpreter;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
@@ -1114,7 +1113,8 @@ public enum Property {
   TABLE_FORMATTER_CLASS("table.formatter", DefaultFormatter.class.getName(), PropertyType.STRING,
       "The Formatter class to apply on results in the shell", "1.4.0"),
   @Deprecated(since = "2.1.0")
-  TABLE_INTERPRETER_CLASS("table.interepreter", DefaultScanInterpreter.class.getName(),
+  TABLE_INTERPRETER_CLASS("table.interepreter",
+      org.apache.accumulo.core.util.interpret.DefaultScanInterpreter.class.getName(),
       PropertyType.STRING,
       "The ScanInterpreter class to apply on scan arguments in the shell. "
           + "Note that this property is deprecated and will be removed in a future version.",
diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java
index ed54c72707..d7d2283025 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java
@@ -517,15 +517,8 @@ public class ZooInfoViewer implements KeywordExecutable {
   }
 
   private static class NullWatcher extends PropStoreWatcher {
-
     public NullWatcher(ReadyMonitor zkReadyMonitor) {
       super(zkReadyMonitor);
     }
-
-    public static NullWatcher get() {
-      ReadyMonitor monitor = new ReadyMonitor("property-printer", 2000);
-      monitor.setReady();
-      return new NullWatcher(monitor);
-    }
   }
 }
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index fa7e6946b8..863ffb011c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -120,7 +120,6 @@ import org.apache.accumulo.shell.commands.ImportDirectoryCommand;
 import org.apache.accumulo.shell.commands.ImportTableCommand;
 import org.apache.accumulo.shell.commands.InfoCommand;
 import org.apache.accumulo.shell.commands.InsertCommand;
-import org.apache.accumulo.shell.commands.InterpreterCommand;
 import org.apache.accumulo.shell.commands.ListBulkCommand;
 import org.apache.accumulo.shell.commands.ListCompactionsCommand;
 import org.apache.accumulo.shell.commands.ListIterCommand;
@@ -379,7 +378,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
 
     @SuppressWarnings("deprecation")
     Command[] dataCommands = {new DeleteCommand(), new DeleteManyCommand(), new DeleteRowsCommand(),
-        new EGrepCommand(), new FormatterCommand(), new InterpreterCommand(), new GrepCommand(),
+        new EGrepCommand(), new FormatterCommand(),
+        new org.apache.accumulo.shell.commands.InterpreterCommand(), new GrepCommand(),
         new ImportDirectoryCommand(), new InsertCommand(), new MaxRowCommand(), new ScanCommand()};
     @SuppressWarnings("deprecation")
     Command[] debuggingCommands =
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteManyCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteManyCommand.java
index e21f8b0036..5384736b53 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteManyCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteManyCommand.java
@@ -27,7 +27,6 @@ import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.iterators.SortedKeyIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.format.FormatterConfig;
-import org.apache.accumulo.core.util.interpret.ScanInterpreter;
 import org.apache.accumulo.shell.Shell;
 import org.apache.accumulo.shell.format.DeleterFormatter;
 import org.apache.commons.cli.CommandLine;
@@ -43,7 +42,8 @@ public class DeleteManyCommand extends ScanCommand {
     final String tableName = OptUtil.getTableOpt(cl, shellState);
 
     @SuppressWarnings("deprecation")
-    final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
+    final org.apache.accumulo.core.util.interpret.ScanInterpreter interpeter =
+        getInterpreter(cl, tableName, shellState);
 
     // handle first argument, if present, the authorizations list to
     // scan with
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/GrepCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/GrepCommand.java
index f7211e7f50..6ceeb26b9c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/GrepCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/GrepCommand.java
@@ -27,7 +27,6 @@ import org.apache.accumulo.core.iterators.user.GrepIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.format.Formatter;
 import org.apache.accumulo.core.util.format.FormatterConfig;
-import org.apache.accumulo.core.util.interpret.ScanInterpreter;
 import org.apache.accumulo.shell.Shell;
 import org.apache.accumulo.shell.Shell.PrintFile;
 import org.apache.commons.cli.CommandLine;
@@ -52,7 +51,8 @@ public class GrepCommand extends ScanCommand {
       }
       final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);
       @SuppressWarnings("deprecation")
-      final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
+      final org.apache.accumulo.core.util.interpret.ScanInterpreter interpeter =
+          getInterpreter(cl, tableName, shellState);
 
       // handle first argument, if present, the authorizations list to
       // scan with
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java
index fbfc364d78..32eab84c58 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java
@@ -20,7 +20,6 @@ package org.apache.accumulo.shell.commands;
 
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.interpret.ScanInterpreter;
 import org.apache.accumulo.shell.Shell;
 import org.apache.commons.cli.CommandLine;
 import org.apache.hadoop.io.Text;
@@ -37,7 +36,8 @@ public class MaxRowCommand extends ScanCommand {
     final String tableName = OptUtil.getTableOpt(cl, shellState);
 
     @SuppressWarnings("deprecation")
-    final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
+    final org.apache.accumulo.core.util.interpret.ScanInterpreter interpeter =
+        getInterpreter(cl, tableName, shellState);
 
     final Range range = getRange(cl, interpeter);
     final Authorizations auths = getAuths(cl, shellState);
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
index 6d49ed3a68..bfe200e50a 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
@@ -43,8 +43,6 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.format.Formatter;
 import org.apache.accumulo.core.util.format.FormatterConfig;
-import org.apache.accumulo.core.util.interpret.DefaultScanInterpreter;
-import org.apache.accumulo.core.util.interpret.ScanInterpreter;
 import org.apache.accumulo.shell.Shell;
 import org.apache.accumulo.shell.Shell.Command;
 import org.apache.accumulo.shell.Shell.PrintFile;
@@ -94,7 +92,8 @@ public class ScanCommand extends Command {
 
       final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);
       @SuppressWarnings("deprecation")
-      final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
+      final org.apache.accumulo.core.util.interpret.ScanInterpreter interpeter =
+          getInterpreter(cl, tableName, shellState);
 
       String classLoaderContext = null;
       if (cl.hasOption(contextOpt.getOpt())) {
@@ -217,23 +216,23 @@ public class ScanCommand extends Command {
   }
 
   @Deprecated(since = "2.1.0")
-  protected ScanInterpreter getInterpreter(final CommandLine cl, final String tableName,
-      final Shell shellState) throws Exception {
+  protected org.apache.accumulo.core.util.interpret.ScanInterpreter getInterpreter(
+      final CommandLine cl, final String tableName, final Shell shellState) throws Exception {
 
-    Class<? extends ScanInterpreter> clazz = null;
+    Class<? extends org.apache.accumulo.core.util.interpret.ScanInterpreter> clazz = null;
     try {
       if (cl.hasOption(interpreterOpt.getOpt())) {
         Shell.log
             .warn("Scan Interpreter option is deprecated and will be removed in a future version.");
 
         clazz = ClassLoaderUtil.loadClass(cl.getOptionValue(interpreterOpt.getOpt()),
-            ScanInterpreter.class);
+            org.apache.accumulo.core.util.interpret.ScanInterpreter.class);
       } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) {
         Shell.log
             .warn("Scan Interpreter option is deprecated and will be removed in a future version.");
 
         clazz = ClassLoaderUtil.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()),
-            ScanInterpreter.class);
+            org.apache.accumulo.core.util.interpret.ScanInterpreter.class);
       }
     } catch (ClassNotFoundException e) {
       Shell.log.error("Interpreter class could not be loaded.", e);
@@ -243,7 +242,7 @@ public class ScanCommand extends Command {
       clazz = InterpreterCommand.getCurrentInterpreter(tableName, shellState);
 
     if (clazz == null)
-      clazz = DefaultScanInterpreter.class;
+      clazz = org.apache.accumulo.core.util.interpret.DefaultScanInterpreter.class;
 
     return clazz.getDeclaredConstructor().newInstance();
   }
@@ -272,7 +271,7 @@ public class ScanCommand extends Command {
   }
 
   protected void fetchColumns(final CommandLine cl, final ScannerBase scanner,
-      @SuppressWarnings("deprecation") final ScanInterpreter formatter)
+      @SuppressWarnings("deprecation") final org.apache.accumulo.core.util.interpret.ScanInterpreter formatter)
       throws UnsupportedEncodingException {
 
     if ((cl.hasOption(scanOptCf.getOpt()) || cl.hasOption(scanOptCq.getOpt()))
@@ -288,19 +287,24 @@ public class ScanCommand extends Command {
       for (String a : cl.getOptionValue(scanOptColumns.getOpt()).split(",")) {
         final String[] sa = a.split(":", 2);
         if (sa.length == 1) {
-          scanner.fetchColumnFamily(
-              formatter.interpretColumnFamily(new Text(a.getBytes(Shell.CHARSET))));
+          @SuppressWarnings("deprecation")
+          var interprettedCF = formatter.interpretColumnFamily(new Text(a.getBytes(Shell.CHARSET)));
+          scanner.fetchColumnFamily(interprettedCF);
         } else {
-          scanner.fetchColumn(
-              formatter.interpretColumnFamily(new Text(sa[0].getBytes(Shell.CHARSET))),
-              formatter.interpretColumnQualifier(new Text(sa[1].getBytes(Shell.CHARSET))));
+          @SuppressWarnings("deprecation")
+          var interprettedCF =
+              formatter.interpretColumnFamily(new Text(sa[0].getBytes(Shell.CHARSET)));
+          @SuppressWarnings("deprecation")
+          var interprettedCQ =
+              formatter.interpretColumnQualifier(new Text(sa[1].getBytes(Shell.CHARSET)));
+          scanner.fetchColumn(interprettedCF, interprettedCQ);
         }
       }
     }
   }
 
   private void fetchColumsWithCFAndCQ(CommandLine cl, Scanner scanner,
-      @SuppressWarnings("deprecation") ScanInterpreter interpeter) {
+      @SuppressWarnings("deprecation") org.apache.accumulo.core.util.interpret.ScanInterpreter interpeter) {
     String cf = "";
     String cq = "";
     if (cl.hasOption(scanOptCf.getOpt())) {
@@ -315,19 +319,23 @@ public class ScanCommand extends Command {
           scanOptCf.getOpt(), scanOptCq.getOpt());
       throw new IllegalArgumentException(formattedString);
     } else if (!cf.isEmpty() && cq.isEmpty()) {
-      scanner.fetchColumnFamily(
-          interpeter.interpretColumnFamily(new Text(cf.getBytes(Shell.CHARSET))));
-
+      @SuppressWarnings("deprecation")
+      var interprettedCF = interpeter.interpretColumnFamily(new Text(cf.getBytes(Shell.CHARSET)));
+      scanner.fetchColumnFamily(interprettedCF);
     } else if (!cf.isEmpty() && !cq.isEmpty()) {
-      scanner.fetchColumn(interpeter.interpretColumnFamily(new Text(cf.getBytes(Shell.CHARSET))),
-          interpeter.interpretColumnQualifier(new Text(cq.getBytes(Shell.CHARSET))));
+      @SuppressWarnings("deprecation")
+      var interprettedCF = interpeter.interpretColumnFamily(new Text(cf.getBytes(Shell.CHARSET)));
+      @SuppressWarnings("deprecation")
+      var interprettedCQ =
+          interpeter.interpretColumnQualifier(new Text(cq.getBytes(Shell.CHARSET)));
+      scanner.fetchColumn(interprettedCF, interprettedCQ);
 
     }
 
   }
 
   protected Range getRange(final CommandLine cl,
-      @SuppressWarnings("deprecation") final ScanInterpreter formatter)
+      @SuppressWarnings("deprecation") final org.apache.accumulo.core.util.interpret.ScanInterpreter formatter)
       throws UnsupportedEncodingException {
     if ((cl.hasOption(OptUtil.START_ROW_OPT) || cl.hasOption(OptUtil.END_ROW_OPT))
         && cl.hasOption(scanOptRow.getOpt())) {
@@ -338,15 +346,23 @@ public class ScanCommand extends Command {
     }
 
     if (cl.hasOption(scanOptRow.getOpt())) {
-      return new Range(formatter
-          .interpretRow(new Text(cl.getOptionValue(scanOptRow.getOpt()).getBytes(Shell.CHARSET))));
+      @SuppressWarnings("deprecation")
+      var interprettedRow = formatter
+          .interpretRow(new Text(cl.getOptionValue(scanOptRow.getOpt()).getBytes(Shell.CHARSET)));
+      return new Range(interprettedRow);
     } else {
       Text startRow = OptUtil.getStartRow(cl);
-      if (startRow != null)
-        startRow = formatter.interpretBeginRow(startRow);
+      if (startRow != null) {
+        @SuppressWarnings("deprecation")
+        var interprettedBeginRow = formatter.interpretBeginRow(startRow);
+        startRow = interprettedBeginRow;
+      }
       Text endRow = OptUtil.getEndRow(cl);
-      if (endRow != null)
-        endRow = formatter.interpretEndRow(endRow);
+      if (endRow != null) {
+        @SuppressWarnings("deprecation")
+        var interprettedEndRow = formatter.interpretEndRow(endRow);
+        endRow = interprettedEndRow;
+      }
       final boolean startInclusive = !cl.hasOption(optStartRowExclusive.getOpt());
       final boolean endInclusive = !cl.hasOption(optEndRowExclusive.getOpt());
       return new Range(startRow, startInclusive, endRow, endInclusive);