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
Test case:
I get:
Platform: Debian Sid (Linux) on x86_64 rjb: 1.5.5 Ruby: 2.3.5 OpenJDK JRE: 8u151