SSLErrorWaitReadable patch to be lightweight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/java/org/jruby/ext/openssl/SSL.java b/src/main/java/org/jruby/ext/openssl/SSL.java | |
index 5bbc76d..79f12b7 100644 | |
--- a/src/main/java/org/jruby/ext/openssl/SSL.java | |
+++ b/src/main/java/org/jruby/ext/openssl/SSL.java | |
@@ -183,7 +183,7 @@ public class SSL { | |
if ( errorClass == null ) { // < Ruby 2.0 | |
errorClass = _SSL(runtime).getClass("SSLError"); // fallback | |
} | |
- return Utils.newError(runtime, errorClass, message, false); | |
+ return Utils.newLightweightError(runtime, errorClass, message, false); | |
} | |
static RubyModule _SSL(final Ruby runtime) { | |
diff --git a/src/main/java/org/jruby/ext/openssl/Utils.java b/src/main/java/org/jruby/ext/openssl/Utils.java | |
index 3071a61..f769087 100644 | |
--- a/src/main/java/org/jruby/ext/openssl/Utils.java | |
+++ b/src/main/java/org/jruby/ext/openssl/Utils.java | |
@@ -30,6 +30,7 @@ package org.jruby.ext.openssl; | |
import java.io.IOException; | |
import org.jruby.Ruby; | |
+import org.jruby.RubyArray; | |
import org.jruby.RubyBasicObject; | |
import org.jruby.RubyClass; | |
import org.jruby.RubyModule; | |
@@ -89,6 +90,10 @@ final class Utils { | |
return ex; | |
} | |
+ static RaiseException newLightweightError(Ruby runtime, RubyClass errorClass, String message, boolean nativeException) { | |
+ return new RaiseException(runtime, errorClass, "SSL WaitReadable/Writable errors do not have backtraces", RubyArray.newEmptyArray(runtime), nativeException); | |
+ } | |
+ | |
static boolean hasNonNilInstanceVariable(final IRubyObject self, final String var) { | |
final IRubyObject val = self.getInstanceVariables().getInstanceVariable(var); | |
return val != null && ! val.isNil(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment