accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/6] accumulo git commit: ACCUMULO-4369 Restructure try-catch to ensure a logical exception is raised
Date Mon, 11 Jul 2016 20:40:30 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.7 b70b52810 -> 196b6bdb9
  refs/heads/1.8 757dedf7a -> 4c4ad8664
  refs/heads/master ad6e98112 -> bf7290546


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/1.7
Commit: 196b6bdb94c4731f30e10bfd651ca55c8b4828ac
Parents: b70b528
Author: Josh Elser <elserj@apache.org>
Authored: Mon Jul 11 15:46:19 2016 -0400
Committer: Josh Elser <elserj@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);
     }
   }
 


Mime
View raw message