You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ss...@apache.org on 2015/04/02 08:32:51 UTC
hbase git commit: HBASE-13058 Hbase shell command 'scan' for non
existent table shows unnecessary info for one unrelated existent table.
(Abhishek Kumar)
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 <ss...@cloudera.com>
Authored: Wed Apr 1 23:29:55 2015 -0700
Committer: Srikanth Srungarapu <ss...@cloudera.com>
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