Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 25D8317B3F for ; Thu, 2 Apr 2015 06:32:52 +0000 (UTC) Received: (qmail 78126 invoked by uid 500); 2 Apr 2015 06:32:52 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 78081 invoked by uid 500); 2 Apr 2015 06:32:52 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 78072 invoked by uid 99); 2 Apr 2015 06:32:51 -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; Thu, 02 Apr 2015 06:32:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C1602E2F2A; Thu, 2 Apr 2015 06:32:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ssrungarapu@apache.org To: commits@hbase.apache.org Message-Id: <59298c28223c44a284fc1e4966e70f7e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-13058 Hbase shell command 'scan' for non existent table shows unnecessary info for one unrelated existent table. (Abhishek Kumar) Date: Thu, 2 Apr 2015 06:32:51 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/master 22d9766aa -> 2392a3e43 HBASE-13058 Hbase shell command 'scan' for non existent table shows unnecessary info for one unrelated existent table. (Abhishek Kumar) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2392a3e4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2392a3e4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2392a3e4 Branch: refs/heads/master Commit: 2392a3e43794029170acac84a37300512e1393f1 Parents: 22d9766 Author: Srikanth Srungarapu Authored: Wed Apr 1 23:29:55 2015 -0700 Committer: Srikanth Srungarapu Committed: Wed Apr 1 23:29:55 2015 -0700 ---------------------------------------------------------------------- hbase-shell/src/main/ruby/shell/commands.rb | 18 +++++++----------- .../main/ruby/shell/commands/clone_snapshot.rb | 7 +++++++ 2 files changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/2392a3e4/hbase-shell/src/main/ruby/shell/commands.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index 2128164..2abccdd 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -102,9 +102,13 @@ module Shell # Get the special java exception which will be handled cause = e.cause + # let individual command handle exceptions first + if self.respond_to?(:handle_exceptions) + self.handle_exceptions(cause, *args) + end + # Global HBase exception handling below if not handled by respective command above if cause.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then - str = java.lang.String.new("#{cause}") - raise "Unknown table #{str}!" + raise "Unknown table #{args.first}!" end if cause.kind_of?(org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException) then exceptions = cause.getCauses @@ -116,15 +120,7 @@ module Shell end end if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then - str = java.lang.String.new("#{cause}") - strs = str.split("\n") - if strs.size > 0 then - s = strs[0].split(' '); - if(s.size > 1) - raise "Table already exists: #{s[1]}!" - end - raise "Table already exists: #{strs[0]}!" - end + raise "Table already exists: #{args.first}!" end # To be safe, here only AccessDeniedException is considered. In future # we might support more in more generic approach when possible. http://git-wip-us.apache.org/repos/asf/hbase/blob/2392a3e4/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb index 8c193bb..0498c8e 100644 --- a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb +++ b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb @@ -36,6 +36,13 @@ EOF admin.clone_snapshot(snapshot_name, table) end end + + def handle_exceptions(cause, *args) + if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then + tableName = args[1] + raise "Table already exists: #{tableName}!" + end + end end end end