Skip to content

Commit b6e9b2e

Browse files
committed
[refactor] cleanup load.rb (we can assume JRuby >= 9.2)
1 parent d67cf9a commit b6e9b2e

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

lib/jopenssl/load.rb

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
warn 'Loading jruby-openssl gem in a non-JRuby interpreter' unless defined? JRUBY_VERSION
2-
31
require 'jopenssl/version'
42

53
# NOTE: assuming user does pull in BC .jars from somewhere else on the CP
@@ -25,16 +23,7 @@
2523
end
2624

2725
require 'jopenssl.jar'
28-
29-
if JRuby::Util.respond_to?(:load_ext) # JRuby 9.2
30-
JRuby::Util.load_ext('org.jruby.ext.openssl.OpenSSL')
31-
else; require 'jruby'
32-
org.jruby.ext.openssl.OpenSSL.load(JRuby.runtime)
33-
end
34-
35-
if RUBY_VERSION > '2.3'
36-
load 'jopenssl/_compat23.rb'
37-
end
26+
JRuby::Util.load_ext('org.jruby.ext.openssl.OpenSSL')
3827

3928
# NOTE: content bellow should live in *lib/openssl.rb* but due RubyGems/Bundler
4029
# `autoload :OpenSSL` this will cause issues if an older version (0.11) is the
@@ -61,7 +50,6 @@ module OpenSSL
6150
require 'openssl/bn'
6251
require 'openssl/pkey'
6352
require 'openssl/cipher'
64-
#require 'openssl/config' if OpenSSL.const_defined?(:Config, false)
6553
require 'openssl/digest'
6654
require 'openssl/hmac'
6755
require 'openssl/x509'
@@ -80,4 +68,6 @@ def self.secure_compare(a, b)
8068
hashed_b = OpenSSL::Digest.digest('SHA256', b)
8169
OpenSSL.fixed_length_secure_compare(hashed_a, hashed_b) && a == b
8270
end
83-
end
71+
end
72+
73+
load 'jopenssl/_compat23.rb'

0 commit comments

Comments
 (0)