You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kares
changed the title
Uncaught Ruby Exception on JRuby 1.7.16
exceptions thrown by Ruby not propagated to calling Ruby when some Java involved in between
Aug 16, 2015
…ruby#2232)
this no longer makese sense - and leads to confusing behavior when Ruby objects are used within Java (delegating to <=> which might be user-defined)
every-one is expected to handle <=> on 1.9 (and return nil if not comparable)
on 1.8 we still swallow a NoMethodError as Object does not provide <=>
* 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
It seems that exceptions thrown by Ruby code are not propagated to the calling Ruby method when some Java code is involved in between.
Proof of concept: https://github.com/gmalkas/jruby-uncaught-exception-issue/blob/master/not_working.rb
Run the test:
The previous code should print
Rescued StandardError
twice but does not.On the other hand, if the rescuing Ruby code is calling the failing code directly (without involving Java code), it works as expected: https://github.com/gmalkas/jruby-uncaught-exception-issue/blob/master/working.rb
Version information:
jruby 1.7.16 (1.9.3p392) 2014-09-25 575b395 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 +jit [linux-amd64]
Let me know if you need any additional information.
Thank you!
The text was updated successfully, but these errors were encountered: