diff --git a/bin/draining_servers.rb b/bin/draining_servers.rb index 68496051cff..8a615a8c8f2 100644 --- a/bin/draining_servers.rb +++ b/bin/draining_servers.rb @@ -21,12 +21,12 @@ require 'optparse' include Java -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.client.ConnectionFactory -import org.apache.hadoop.hbase.client.HBaseAdmin -import org.apache.hadoop.hbase.zookeeper.ZKUtil -import org.apache.commons.logging.Log -import org.apache.commons.logging.LogFactory +java_import org.apache.hadoop.hbase.HBaseConfiguration +java_import org.apache.hadoop.hbase.client.ConnectionFactory +java_import org.apache.hadoop.hbase.client.HBaseAdmin +java_import org.apache.hadoop.hbase.zookeeper.ZKUtil +java_import org.apache.commons.logging.Log +java_import org.apache.commons.logging.LogFactory # Name of this script NAME = "draining_servers" diff --git a/bin/get-active-master.rb b/bin/get-active-master.rb index f7e1ff67935..bd303b3e417 100644 --- a/bin/get-active-master.rb +++ b/bin/get-active-master.rb @@ -18,10 +18,10 @@ # Prints the hostname of the machine running the active master. include Java -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.ServerName -import org.apache.hadoop.hbase.zookeeper.ZKUtil -import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher +java_import org.apache.hadoop.hbase.HBaseConfiguration +java_import org.apache.hadoop.hbase.ServerName +java_import org.apache.hadoop.hbase.zookeeper.ZKUtil +java_import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher # disable debug/info logging on this script for clarity log_level = org.apache.log4j.Level::ERROR diff --git a/bin/region_status.rb b/bin/region_status.rb index f889de9ec82..aab7e12f20a 100644 --- a/bin/region_status.rb +++ b/bin/region_status.rb @@ -45,19 +45,19 @@ end require 'java' -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.TableName -import org.apache.hadoop.hbase.HConstants -import org.apache.hadoop.hbase.MasterNotRunningException -import org.apache.hadoop.hbase.client.HBaseAdmin -import org.apache.hadoop.hbase.client.Table -import org.apache.hadoop.hbase.client.Scan -import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter -import org.apache.hadoop.hbase.util.Bytes -import org.apache.hadoop.hbase.HRegionInfo -import org.apache.hadoop.hbase.MetaTableAccessor -import org.apache.hadoop.hbase.HTableDescriptor -import org.apache.hadoop.hbase.client.ConnectionFactory +java_import org.apache.hadoop.hbase.HBaseConfiguration +java_import org.apache.hadoop.hbase.TableName +java_import org.apache.hadoop.hbase.HConstants +java_import org.apache.hadoop.hbase.MasterNotRunningException +java_import org.apache.hadoop.hbase.client.HBaseAdmin +java_import org.apache.hadoop.hbase.client.Table +java_import org.apache.hadoop.hbase.client.Scan +java_import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter +java_import org.apache.hadoop.hbase.util.Bytes +java_import org.apache.hadoop.hbase.HRegionInfo +java_import org.apache.hadoop.hbase.MetaTableAccessor +java_import org.apache.hadoop.hbase.HTableDescriptor +java_import org.apache.hadoop.hbase.client.ConnectionFactory # disable debug logging on this script for clarity log_level = org.apache.log4j.Level::ERROR diff --git a/bin/replication/copy_tables_desc.rb b/bin/replication/copy_tables_desc.rb index a7cc3a3fd1d..a265bf14036 100644 --- a/bin/replication/copy_tables_desc.rb +++ b/bin/replication/copy_tables_desc.rb @@ -24,13 +24,14 @@ # include Java -import org.apache.commons.logging.LogFactory -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.HConstants -import org.apache.hadoop.hbase.client.HBaseAdmin -import org.apache.hadoop.hbase.HTableDescriptor -import org.apache.hadoop.conf.Configuration -import org.apache.hadoop.hbase.client.ConnectionFactory +java_import org.apache.commons.logging.LogFactory +java_import org.apache.hadoop.conf.Configuration +java_import org.apache.hadoop.hbase.HBaseConfiguration +java_import org.apache.hadoop.hbase.HConstants +java_import org.apache.hadoop.hbase.HTableDescriptor +java_import org.apache.hadoop.hbase.TableName +java_import org.apache.hadoop.hbase.client.ConnectionFactory +java_import org.apache.hadoop.hbase.client.HBaseAdmin # Name of this script NAME = "copy_tables_desc" @@ -44,7 +45,7 @@ end def copy (src, dst, table) # verify if table exists in source cluster begin - t = src.getTableDescriptor(table.to_java_bytes) + t = src.getTableDescriptor(TableName.valueOf(table)) rescue org.apache.hadoop.hbase.TableNotFoundException puts "Source table \"%s\" doesn't exist, skipping." % table return diff --git a/bin/shutdown_regionserver.rb b/bin/shutdown_regionserver.rb index 608248f44a9..9d514a717a9 100644 --- a/bin/shutdown_regionserver.rb +++ b/bin/shutdown_regionserver.rb @@ -23,9 +23,9 @@ # ./bin/hbase org.jruby.Main bin/shutdown_regionserver.rb c2021:16020 include Java -import org.apache.hadoop.hbase.HBaseConfiguration -import org.apache.hadoop.hbase.client.HBaseAdmin -import org.apache.hadoop.hbase.client.ConnectionFactory +java_import org.apache.hadoop.hbase.HBaseConfiguration +java_import org.apache.hadoop.hbase.client.HBaseAdmin +java_import org.apache.hadoop.hbase.client.ConnectionFactory def usage(msg=nil) $stderr.puts 'Usage: shutdown_regionserver.rb ..' diff --git a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm index 29dd9d55238..96f6bceff00 100644 --- a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm +++ b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm @@ -1349,134 +1349,52 @@ JRuby Incorporated Works Some additional libraries distributed with JRuby are not covered by JRuby's licence. -## skip bytelist and yydebug because they're covered by the jruby copyright and license +## skip bytelist, jnr-posix, jruby-openssl, jruby-readline, psych, and yydebug +## because they're covered by the jruby copyright and license + ## skip rails benchmark javascript, because it's not in the complete jar + +## jruby bundles asm, but we already ref that in our included deps + +jline2 is distributed under the BSD license (available above) and is + + Copyright (c) 2002-2012, the original author or authors. + All rights reserved. + +jzlib is distributed under the BSD license (available above) and is: + + Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved. + The "rake" library (http://rake.rubyforge.org/) is distributed under the MIT license (available above), and has the following copyright: Copyright (c) 2003, 2004 Jim Weirich -## jruby bundles asm, but we already ref that in our included deps -## joda-time only in NOTICE because it's ASLv2 -## commons-logging in NOTICE because it's ASLv2 - build_lib/apt-mirror-api.jar, build_lib/bnd-0.0.249.jar, - BSF and ant are distributed under the Apache Software License, - Version 1.1 (shown below) - ---- ASL v1.1 license -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ ---- End ASL v1.1 license - - build_lib/constantine.jar (http://kenai.com/projects/constantine) ## jruby bundles jcodings and joni, but we already ref that in our included deps - distributed under the MIT license (available above). -## section on ASLv2 incorporated works just in NOTICE -## skip emma and junit; both aren't in the complete jar - build_lib/jline-* (http://jline.sourceforge.net) is distributed - under the following BSD-style license: +Bouncycastle is released under the MIT license (available above), +and is Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle. - Redistribution and use in source and binary forms, with or - without modification, are permitted provided that the following - conditions are met: +jnr-x86asm is distributed under the MIT license (available above), +with the following copyrights: - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + Copyright (C) 2010 Wayne Meissner + Copyright (c) 2008-2009, Petr Kobalicek - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with - the distribution. +## The following only in NOTICE because they are all ASLv2 +## invokebinder, jffi, jitescript, jnr-constants, jnr-enxio, jnr-ffi, +## jnr-netdb, jnr-unixsocket, joda-time, maven, nailgun, options, +## snakeyaml, unsafe-fences - Neither the name of JLine nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. - -## I couldn't determine what use of bouncycastle this referred to -## so I'm not sure if it's included in the jruby-complete jar or not. - Bouncycastle is released under the MIT license (available above), - and is Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle. - - The "yecht" library is Copyright (c) 2009-2011 Ola Bini, and released - under the MIT license (available above). +## Skip racc, json-generator, json-parser because it is under Ruby license ## jruby bundles jquery, but we already ref that above. - most files found in lib/ruby/1.8, lib/ruby/1.9, and lib/ruby/site_ruby/1.8/rubygems* - are distributed under The Ruby License's non-GPL provision (available below). +JRuby distributes some ruby modules which are distributed under Ruby +license: Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the GPL -(see the file GPL), or the conditions below: +You can redistribute it and/or modify it under either the terms of the +2-clause BSDL (see the file BSDL), or the conditions below: 1. You may make and give away verbatim copies of the source form of the software without restriction, provided that you duplicate all of the @@ -2574,10 +2492,6 @@ Common Public License - v 1.0 more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. #end -## We put the JRuby incorporated works bits here, since we first reference JRuby in the CPL section. -#if($jruby) -#jruby_license() -#end #if(!(${epl.isEmpty()})) ==== ## print all the EPL 1.0 licensed works @@ -2833,4 +2747,8 @@ This product includes the following works licensed under the Eclipse Public Lice Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. #end +## We put the JRuby incorporated works bits here, since we first reference JRuby in the EPL section. +#if($jruby) +#jruby_license() +#end #end diff --git a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm index 4be6017c2ee..c77ade53e70 100644 --- a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm +++ b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm @@ -175,38 +175,29 @@ JRuby Incorporated Works Some additional libraries distributed with JRuby are not covered by JRuby's licence. -## skip bytelist and yydebug because they're covered by the jruby copyright and license +## skip bytelist, jnr-posix, jruby-openssl, jruby-readline, psych, and yydebug +## because they're covered by the jruby copyright and license + ## skip rails benchmark javascript, because it's not in the complete jar -## skip rake because MIT + ## jruby bundles asm, but we already ref that in our included deps - build_lib/apt-mirror-api.jar, build_lib/bnd-0.0.249.jar, - BSF and ant are distributed under the Apache Software License, - Version 1.1 +## skip jline2, jzlib because BSD-3 + +## skip rake because MIT -## skip constantine because MIT ## jruby bundles jcodings and joni, but we already ref that in our included deps - build_lib/commons-logging-1.1.1.jar - build_lib/jarjar-1.0rc8.jar (http://code.google.com/p/jarjar), - build_lib/joda-time-1.6.2.jar (http://joda-time.sourceforge.net), - build_lib/jffi*jar (https://github.com/wmeissner/jffi), - build_lib/jaffl.jar (https://github.com/wmeissner/jaffl), - build_lib/jnr-netdb.jar (http://github.com/wmeissner/jnr-netdb), - build_lib/dynalang-0.3.jar (http://dynalang.sourceforge.net), - build_lib/nailgun-0.7.1.jar and tool/nailgun/ng.exe - (http://martiansoftware.com/nailgun) are distributed under the - Apache License version 2.0. -## skip emma and junit; both aren't in the complete jar -## skip jline because BSD-3 -## skip bouncy because MIT -## skip yecht because MIT -## skip jquery because MIT +## skip Bouncycastle, jnr-x86asm because MIT - most files found in lib/ruby/1.8, lib/ruby/1.9, and lib/ruby/site_ruby/1.8/rubygems* - are distributed under The Ruby License's non-GPL provision, see LICENSE for details and - http://jruby.org/ for source. + invokebinder, jffi, jitescript, jnr-constants, jnr-enxio, jnr-ffi, + jnr-netdb, jnr-unixsocket, joda-time, maven, nailgun, options, + snakeyaml, unsafe-fences are distributed under the Apache License + version 2.0. +## Skip racc, json-generator, json-parser because it is under Ruby license + +## jruby bundles jquery, but we already ref that above. #end ## first bundled source #if(${bundled-logo}) diff --git a/hbase-resource-bundle/src/main/resources/supplemental-models.xml b/hbase-resource-bundle/src/main/resources/supplemental-models.xml index 708530b0759..57ce56fa0c7 100644 --- a/hbase-resource-bundle/src/main/resources/supplemental-models.xml +++ b/hbase-resource-bundle/src/main/resources/supplemental-models.xml @@ -2671,11 +2671,11 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice - Common Public License Version 1.0 - http://www-128.ibm.com/developerworks/library/os-cpl.html + Eclipse Public License 1.0 + http://www.eclipse.org/legal/epl-v10.html repo -Copyright (c) 2007-2011 The JRuby project +Copyright (c) 2007-2017 The JRuby project diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index 6a9458be2d1..9739a13ecb2 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -76,9 +76,9 @@ module Hbase end begin - @admin.compactRegion(table_or_region_name.to_java_bytes, family_bytes, false) + @admin.compactRegion(table_or_region_name.to_java_bytes, family_bytes) rescue java.lang.IllegalArgumentException => e - @admin.compact(TableName.valueOf(table_or_region_name), family_bytes, false, compact_type) + @admin.compact(TableName.valueOf(table_or_region_name), family_bytes, compact_type) end end @@ -472,14 +472,17 @@ module Hbase #---------------------------------------------------------------------------------------------- # Returns table's structure description def describe(table_name) + tableExists(table_name) @admin.getTableDescriptor(TableName.valueOf(table_name)).to_s end def get_column_families(table_name) + tableExists(table_name) @admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies() end def get_table_attributes(table_name) + tableExists(table_name) @admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes end @@ -868,7 +871,7 @@ module Hbase family.setMobEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB) family.setMobThreshold(JLong.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER) - bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase + bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase.to_sym unless org.apache.hadoop.hbase.regionserver.BloomType.constants.include?(bloomtype) raise(ArgumentError, "BloomFilter type #{bloomtype} is not supported. Use one of " + org.apache.hadoop.hbase.regionserver.StoreFile::BloomType.constants.join(" ")) else @@ -876,7 +879,7 @@ module Hbase end end if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION) - compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION).upcase + compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION).upcase.to_sym unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression) raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" ")) else @@ -894,7 +897,7 @@ module Hbase end end if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT) - compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT).upcase + compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION_COMPACT).upcase.to_sym unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression) raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" ")) else @@ -906,7 +909,7 @@ module Hbase family.setStoragePolicy(storage_policy) end if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY) - mob_partition_policy = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY).upcase + mob_partition_policy = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_COMPACT_PARTITION_POLICY).upcase.to_sym unless org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.include?(mob_partition_policy) raise(ArgumentError, "MOB_COMPACT_PARTITION_POLICY #{mob_partition_policy} is not supported. Use one of " + org.apache.hadoop.hbase.client.MobCompactPartitionPolicy.constants.join(" ")) else diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb index 4c884d6e01d..6dd1fe0efcf 100644 --- a/hbase-shell/src/main/ruby/hbase/security.rb +++ b/hbase-shell/src/main/ruby/hbase/security.rb @@ -154,7 +154,7 @@ module Hbase yield(user_name, "#{namespace},#{table},#{family},#{qualifier}: #{action.to_s}") else res[user_name] ||= {} - res[user_name][family + ":" +qualifier] = action + res[user_name]["#{family}:#{qualifier}"] = action end count += 1 end diff --git a/hbase-shell/src/main/ruby/hbase_constants.rb b/hbase-shell/src/main/ruby/hbase_constants.rb index 8f1b797c6b2..55806cf4f72 100644 --- a/hbase-shell/src/main/ruby/hbase_constants.rb +++ b/hbase-shell/src/main/ruby/hbase_constants.rb @@ -27,9 +27,9 @@ # whether the table exists and returns nil regardless. include Java -include_class('java.lang.Integer') {|package,name| "J#{name}" } -include_class('java.lang.Long') {|package,name| "J#{name}" } -include_class('java.lang.Boolean') {|package,name| "J#{name}" } +java_import('java.lang.Integer') { |_package, name| "J#{name}" } +java_import('java.lang.Long') { |_package, name| "J#{name}" } +java_import('java.lang.Boolean') { |_package, name| "J#{name}" } module HBaseConstants COLUMN = "COLUMN" diff --git a/hbase-shell/src/main/ruby/irb/hirb.rb b/hbase-shell/src/main/ruby/irb/hirb.rb index b32e691cf8c..4d6d2771728 100644 --- a/hbase-shell/src/main/ruby/irb/hirb.rb +++ b/hbase-shell/src/main/ruby/irb/hirb.rb @@ -19,7 +19,7 @@ require 'rbconfig' module IRB - WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/ + WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # Subclass of IRB so can intercept methods class HIRB < Irb diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index 08f2e111064..5f7a2e621f2 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -39,7 +39,9 @@ module Shell translate_hbase_exceptions(*args) { send(cmd, *args) } rescue => e rootCause = e - while rootCause != nil && rootCause.respond_to?(:cause) && rootCause.cause != nil + + # JRuby9000 made RubyException respond to cause, ignore it for back compat + while !rootCause.is_a?(Exception) && rootCause.respond_to?(:cause) && !rootCause.cause.nil? rootCause = rootCause.cause end if @shell.interactive? @@ -105,13 +107,8 @@ module Shell def translate_hbase_exceptions(*args) yield - rescue => e - # Since exceptions will be thrown from the java code, 'e' will always be NativeException. - # Check for the original java exception and use it if present. - raise e unless e.respond_to?(:cause) && e.cause != nil - cause = e.cause - - # let individual command handle exceptions first + rescue => cause + # let individual command handle exceptions first if self.respond_to?(:handle_exceptions) self.handle_exceptions(cause, *args) end @@ -153,7 +150,7 @@ module Shell end # Throw the other exception which hasn't been handled above - raise e + raise cause end end end diff --git a/hbase-shell/src/main/ruby/shell/formatter.rb b/hbase-shell/src/main/ruby/shell/formatter.rb index aa81c864c56..fb481e0ff1a 100644 --- a/hbase-shell/src/main/ruby/shell/formatter.rb +++ b/hbase-shell/src/main/ruby/shell/formatter.rb @@ -31,10 +31,13 @@ module Shell end def refresh_width() + @max_width = 0 if $stdout.tty? - @max_width = Java::jline.Terminal.getTerminal().getTerminalWidth() - else - @max_width = 0 + begin + @max_width = Java::jline.TerminalFactory.get.getWidth + rescue NameError => e + # nocommit debug log and ignore + end end end diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java index 53606e97d5a..7f67b0188be 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java @@ -58,7 +58,7 @@ public abstract class AbstractTestShell { List loadPaths = new ArrayList<>(2); loadPaths.add("src/main/ruby"); loadPaths.add("src/test/ruby"); - jruby.getProvider().setLoadPaths(loadPaths); + jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging", "true"); diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java index 339f5a17068..871240c2e15 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java @@ -39,7 +39,7 @@ public class TestShellNoCluster extends AbstractTestShell { List loadPaths = new ArrayList<>(2); loadPaths.add("src/main/ruby"); loadPaths.add("src/test/ruby"); - jruby.getProvider().setLoadPaths(loadPaths); + jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging", "true"); diff --git a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java index 26da8167c7a..b81249b7fde 100644 --- a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java +++ b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java @@ -77,7 +77,7 @@ public class TestShellRSGroups { List loadPaths = new ArrayList<>(2); loadPaths.add(basePath+"/src/main/ruby"); loadPaths.add(basePath+"/src/test/ruby"); - jruby.getProvider().setLoadPaths(loadPaths); + jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); System.setProperty("jruby.jit.logging.verbose", "true"); System.setProperty("jruby.jit.logging", "true"); diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 18842170085..e42acded240 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -248,8 +248,8 @@ module Hbase #------------------------------------------------------------------------------- define_test "describe should fail for non-existent tables" do - assert_raise(NativeException) do - admin.describe('.NOT.EXISTS.') + assert_raise(ArgumentError) do + admin.describe('NOT.EXISTS') end end diff --git a/pom.xml b/pom.xml index c66c93cb8cb..1751d2d9942 100644 --- a/pom.xml +++ b/pom.xml @@ -1262,7 +1262,7 @@ 2.22.2 6.1.26 6.1.14 - 1.6.8 + 9.1.9.0 4.12 1.3 3.1.0-incubating @@ -1280,8 +1280,9 @@ 1.3.3 4.1.1.Final 3.6.2.Final - 2.1.2 - 1.0.8 + + 2.1.11 + 1.0.18 2.11.6 1.46 1.0.0-RC2