-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$! not always being saved/restored in JRuby runtime when Ruby exceptions are handled #1601
Milestone
Comments
I think with very few exceptions, if we're catching a RaiseException we should probably be clearing |
Reproduced an example using <=>: begin
0 <=> Time.now
rescue
puts "AAAA"
end
begin
raise
rescue
puts "C: #{$!}"
end |
Reopening so we can audit code and confirm everything is good. |
kares
pushed a commit
to kares/jruby
that referenced
this issue
Aug 17, 2015
…g the raised exception
kares
added a commit
to kares/jruby
that referenced
this issue
Aug 17, 2015
kares
added a commit
to kares/jruby
that referenced
this issue
Aug 17, 2015
…bility semi-picked from 78e968e (jruby#1601)
kares
added a commit
that referenced
this issue
Aug 18, 2015
* jruby-1_7: some more comparable asserts including for the Java compareTo part native RubySymbol#compareTo since we expect to always be able to sort should not-rewrite jump exceptions twice as well (not just raise ones) delete un-used imports [ji] do not rewrite stack-trace twice for Ruby (raise) exceptions base compareTo should not silence all Ruby raised exceptions (fixes #2232) re-arrange rescue spec (we're about to spec some more behavior) only test nil return from Object cmp on 1.9 (on 1.8.7 its expected to raise) more of correct $! restore + use get/setErrorInfo for better predictability another incorrect $! with numeric coercion on <=> + cleanup getRuntime() Fix some consumers for #1601. Don't leak out if we are swallowing the raised exception Conflicts: core/src/main/java/org/jruby/Main.java core/src/main/java/org/jruby/RubyBasicObject.java core/src/main/java/org/jruby/RubyClass.java core/src/main/java/org/jruby/RubyComparable.java core/src/main/java/org/jruby/RubyNumeric.java core/src/main/java/org/jruby/RubySymbol.java core/src/main/java/org/jruby/RubyTime.java core/src/main/java/org/jruby/javasupport/JavaCallable.java
has been open for 2+y ... just did a quick audit and all seems well. maybe the time has come to close? 😉 |
@kares 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Several classes in the JRuby runtime are catching Ruby exceptions. Those should save the old value of $! and restore them after the exception is handled. A quick grep revealed at the following files that need investigation and possible fixup. I've fixed up RubyFileTest.java in commit d10eade
[subbu@earth ir] grep -l 'catch (RaiseExcep' ../*
../Main.java
../RubyBasicObject.java
../RubyComparable.java
../RubyConverter.java
../RubyEnumerable.java
../RubyEnumerator.java
../RubyFile.java
../RubyFileTest.java
../RubyIO.java
../Ruby.java
../RubyKernel.java
../RubyNumeric.java
../RubyRange.java
../RubyRegexp.java
The text was updated successfully, but these errors were encountered: