Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0730f8

Browse files
committed
Conditionally boot the extension only if not booted already.
Rather than using the older method for booting the jopenssl extension, we now directly load the library. However, this does not enlist in require logic, so it can load twice if done unconditionally. This commit modifies that loading to only occur if the jopenssl.jar library has not been loaded before. Fixes jruby#1071
1 parent e29e513 commit e0730f8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/ruby/shared/openssl.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
# Load extension
1313
require 'jruby'
14-
require 'jopenssl.jar'
15-
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
14+
# only boot ext if jar has not been loaded before
15+
if require 'jopenssl.jar'
16+
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
17+
end
1618

1719
if RUBY_VERSION >= '1.9.0'
1820
load('jopenssl19/openssl.rb')

maven/gems/jruby-openssl/lib/jruby-openssl.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
# Load extension
1717
require 'jruby'
18-
require 'jopenssl.jar'
19-
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
18+
# only boot ext if jar has not been loaded before
19+
if require 'jopenssl.jar'
20+
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
21+
end
2022

2123
if RUBY_VERSION >= '1.9.0'
2224
load('jopenssl19/openssl.rb')

0 commit comments

Comments
 (0)