Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 384F5200B4F for ; Mon, 11 Jul 2016 22:40:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 36C82160A5E; Mon, 11 Jul 2016 20:40:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 819E6160A7D for ; Mon, 11 Jul 2016 22:40:31 +0200 (CEST) Received: (qmail 45900 invoked by uid 500); 11 Jul 2016 20:40:30 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 45820 invoked by uid 99); 11 Jul 2016 20:40:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2016 20:40:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7A2F4E0A3F; Mon, 11 Jul 2016 20:40:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Mon, 11 Jul 2016 20:40:32 -0000 Message-Id: <38a98a77e9f64005a04239573225bf21@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/6] accumulo git commit: ACCUMULO-4369 Restructure try-catch to ensure a logical exception is raised archived-at: Mon, 11 Jul 2016 20:40:32 -0000 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 Authored: Mon Jul 11 15:46:19 2016 -0400 Committer: Josh Elser 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); } }