You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2016/07/11 20:40:32 UTC

[3/6] accumulo git commit: ACCUMULO-4369 Restructure try-catch to ensure a logical exception is raised

ACCUMULO-4369 Restructure try-catch to ensure a logical exception is raised

If getZooInstance throws a RuntimeException, then an IllegalArgumentException
would be re-thrown saying that the client configuration was invalid/missing.
This was because the broad catch on Exception was unintentionally catching
all RTE's as well.


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

Branch: refs/heads/master
Commit: 196b6bdb94c4731f30e10bfd651ca55c8b4828ac
Parents: b70b528
Author: Josh Elser <el...@apache.org>
Authored: Mon Jul 11 15:46:19 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon Jul 11 15:46:19 2016 -0400

----------------------------------------------------------------------
 shell/src/main/java/org/apache/accumulo/shell/Shell.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/196b6bdb/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
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 2dd8068..0005c36 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -169,6 +169,7 @@ import org.apache.commons.cli.MissingOptionException;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Level;
@@ -448,11 +449,13 @@ public class Shell extends ShellOptions implements KeywordExecutable {
         instanceName = options.getZooKeeperInstanceName();
         hosts = options.getZooKeeperHosts();
       }
+      final ClientConfiguration clientConf;
       try {
-        instance = getZooInstance(instanceName, hosts, options.getClientConfiguration());
-      } catch (Exception e) {
+        clientConf = options.getClientConfiguration();
+      } catch (ConfigurationException | FileNotFoundException e) {
         throw new IllegalArgumentException("Unable to load client config from " + options.getClientConfigFile(), e);
       }
+      instance = getZooInstance(instanceName, hosts, clientConf);
     }
   }