Skip to content

Commit

Permalink
Whoopsie. I originally did not understand why we would initialize to …
Browse files Browse the repository at this point in the history
…UNDEF

and had set it to nil (which had it worked out would have removed all
conditionals involving cause).  I missed changing this one back.
  • Loading branch information
enebo committed Apr 2, 2018
1 parent dd996fb commit 45141a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyException.java
Expand Up @@ -71,6 +71,8 @@ public class RubyException extends RubyObject {
public static final int TRACE_MAX = RubyException.TRACE_HEAD + RubyException.TRACE_TAIL + 6;
protected BacktraceData backtraceData;
IRubyObject message;
// We initialize this to UNDEF to know whether cause has been initialized (from ruby space we will just see nil
// but internally we want to know if there was a cause or it was set to nil explicitly).
IRubyObject cause = UNDEF;
private IRubyObject backtrace;
private RaiseException throwable;
Expand Down Expand Up @@ -326,7 +328,7 @@ public void setCause(IRubyObject cause) {

// NOTE: can not have IRubyObject as NativeException has getCause() returning Throwable
public Object getCause() {
return cause.isNil() ? null : cause;
return cause == UNDEF ? null : cause;
}

public void setBacktraceData(BacktraceData backtraceData) {
Expand Down

0 comments on commit 45141a7

Please sign in to comment.