Skip to content

Commit

Permalink
return early instead of going respond_to? - gets String/IO frequently
Browse files Browse the repository at this point in the history
kares committed Nov 3, 2017
1 parent f917e60 commit f03bcc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/jruby/ext/openssl/OpenSSL.java
Original file line number Diff line number Diff line change
@@ -324,6 +324,7 @@ static SecureRandom getSecureRandomFrom(final ThreadContext context) {
// internals

static IRubyObject to_der_if_possible(final ThreadContext context, IRubyObject obj) {
if ( obj instanceof RubyString || obj instanceof RubyIO ) return obj;
if ( ! obj.respondsTo("to_der")) return obj;
return obj.callMethod(context, "to_der");
}

0 comments on commit f03bcc1

Please sign in to comment.