diff --git a/lib/logstash/JRUBY-6970.rb b/lib/logstash/JRUBY-6970.rb new file mode 100644 index 000000000..47501d7a6 --- /dev/null +++ b/lib/logstash/JRUBY-6970.rb @@ -0,0 +1,32 @@ +# Monkeypatch for JRUBY-6970 +module Kernel + alias_method :require_JRUBY_6970_hack, :require + + def require(path) + if path =~ /^jar:file:.+!.+/ + path = path.gsub(/^jar:/, "") + puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1" + end + return require_JRUBY_6970_hack(path) + end +end + +require "openssl" +class OpenSSL::SSL::SSLContext + alias_method :ca_path_JRUBY_6970=, :ca_path= + alias_method :ca_file_JRUBY_6970=, :ca_file= + + def ca_file=(arg) + if arg =~ /^jar:file:\// + return ca_file_JRUBY_6970=(arg.gsub(/^jar:/, "")) + end + return ca_file_JRUBY_6970=(arg) + end + + def ca_path=(arg) + if arg =~ /^jar:file:\// + return ca_path_JRUBY_6970=(arg.gsub(/^jar:/, "")) + end + return ca_path_JRUBY_6970=(arg) + end +end diff --git a/lib/logstash/runner.rb b/lib/logstash/runner.rb index c24ae0800..bcc2ecd79 100644 --- a/lib/logstash/runner.rb +++ b/lib/logstash/runner.rb @@ -1,20 +1,8 @@ -# Monkeypatch for JRUBY-6970 -module Kernel - alias_method :require_JRUBY_6970_hack, :require - - def require(path) - if path =~ /^jar:file:.+!.+/ - path = path.gsub(/^jar:/, "") - puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1" - end - return require_JRUBY_6970_hack(path) - end -end - require "rubygems" require "logstash/namespace" require "logstash/program" require "logstash/util" +require "logstash/JRUBY-6970" if ENV["PROFILE_BAD_LOG_CALLS"] # Set PROFILE_BAD_LOG_CALLS=1 in your environment if you want