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

Skip to content

Commit 0b0f2b3

Browse files
committed
Fix JRUBY-6907
Regression: ruby,java(thread),ruby exception path results in nilClass exception This is another case where removal of the $! setting we did before running exception-handling blocks appeared to be premature or incorrect. There appears to be some paths through exception handling -- perhaps only in the interpreter -- that fail to set $! properly beforehand. I have restored one of these sets, and the case given in the bug report now passes. We should get these cases rolled in; would appreciate if you can adapt them to our JI specs and send us a PR.
1 parent ea231ed commit 0b0f2b3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/org/jruby/ast/RescueNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ private IRubyObject handleException(Ruby runtime, ThreadContext context, IRubyOb
176176
IRubyObject[] exceptions = getExceptions(cRescueNode, runtime, context, self, aBlock);
177177

178178
if (RuntimeHelpers.isExceptionHandled(raisedException, exceptions, context).isTrue()) {
179+
runtime.getGlobalVariables().set("$!", raisedException);
180+
179181
return cRescueNode.interpret(runtime,context, self, aBlock);
180182
}
181183

0 commit comments

Comments
 (0)