accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: Handle shell scan error messages consistently (#1154)
Date Thu, 09 May 2019 19:43:09 GMT
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 4bf20d8  Handle shell scan error messages consistently (#1154)
4bf20d8 is described below

commit 4bf20d8545426464ee12c2c990967dddc20684d5
Author: Christopher Tubbs <ctubbsii@apache.org>
AuthorDate: Thu May 9 15:43:04 2019 -0400

    Handle shell scan error messages consistently (#1154)
    
    * Consistently use the shell's logger to print the error messages so
    they don't get automatically mixed in to scan results output.
    * Remove extraneous newlines in log messages
---
 .../apache/accumulo/shell/commands/ScanCommand.java  | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

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 3d7e0bb..a7fc302 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
@@ -130,9 +130,9 @@ public class ScanCommand extends Command {
           final int length = Integer.parseInt(showLength);
           config.setShownLength(length);
         } catch (NumberFormatException nfe) {
-          shellState.getReader().println("Arg must be an integer.");
+          Shell.log.error("Arg must be an integer.", nfe);
         } catch (IllegalArgumentException iae) {
-          shellState.getReader().println("Arg must be greater than one.");
+          Shell.log.error("Arg must be greater than one.", iae);
         }
       }
       printRecords(cl, shellState, config, scanner, formatter, printFile);
@@ -218,20 +218,20 @@ public class ScanCommand extends Command {
     Class<? extends 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.\n");
+        Shell.log
+            .warn("Scan Interpreter option is deprecated and will be removed in a future
version.");
 
         clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(interpreterOpt.getOpt()),
             ScanInterpreter.class);
       } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) {
-        Shell.log.warn(
-            "Scan Interpreter option is deprecated and will be removed in a future version.\n");
+        Shell.log
+            .warn("Scan Interpreter option is deprecated and will be removed in a future
version.");
 
         clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()),
             ScanInterpreter.class);
       }
     } catch (ClassNotFoundException e) {
-      shellState.getReader().println("Interpreter class could not be loaded.\n" + e.getMessage());
+      Shell.log.error("Interpreter class could not be loaded.", e);
     }
 
     if (clazz == null)
@@ -248,19 +248,19 @@ public class ScanCommand extends Command {
 
     try {
       if (cl.hasOption(formatterOpt.getOpt())) {
-        Shell.log.warn("Formatter option is deprecated and will be removed in a future version.\n");
+        Shell.log.warn("Formatter option is deprecated and will be removed in a future version.");
 
         return shellState.getClassLoader(cl, shellState)
             .loadClass(cl.getOptionValue(formatterOpt.getOpt())).asSubclass(Formatter.class);
       } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) {
-        Shell.log.warn("Formatter option is deprecated and will be removed in a future version.\n");
+        Shell.log.warn("Formatter option is deprecated and will be removed in a future version.");
 
         return shellState.getClassLoader(cl, shellState)
             .loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()))
             .asSubclass(Formatter.class);
       }
     } catch (Exception e) {
-      shellState.getReader().println("Formatter class could not be loaded.\n" + e.getMessage());
+      Shell.log.error("Formatter class could not be loaded.", e);
     }
 
     return shellState.getFormatter(tableName);


Mime
View raw message