arton / rjb

Ruby Java Bridge
https://www.artonx.org/collabo/backyard/?RubyJavaBridge
GNU Lesser General Public License v2.1
117 stars 34 forks source link

Re-raising a Java exception changes its type into RuntimeError #60

Closed anonym closed 5 years ago

anonym commented 6 years ago

Test case:

require 'rjb'
Rjb::load
begin
  Rjb::import('java.lang.Integer').parseInt('x')
rescue => e
  begin
    raise e
  rescue => f
    if e.class == f.class
      puts "I expect the equality to be true"
    else
      puts "Unexpectedly the re-raised Java exception has changed " +
           "from a #{e.class} into a #{f.class}"
    end
  end
end

I get:

Unexpectedly the re-raised Java exception has changed from a NumberFormatException into a RuntimeError

Platform: Debian Sid (Linux) on x86_64 rjb: 1.5.5 Ruby: 2.3.5 OpenJDK JRE: 8u151

arton commented 5 years ago

Hi anonym, Sorry for late respond. I fixed this issue. Thank you.