Java exceptions caught by JRuby and wrapped in a NativeException aren't proxied by default. This makes it harder to interoperate with Java libraries and forces the low level API to be exposed in code using the high level API just to inspect the underlying exception. Example:
require 'java'
include_class 'java.io.File' { 'JFile' }
begin
JFile.new(nil)
rescue Exception => e
end
e.cause.some_method_on_java_object # raises NoMethodError even if someMethodOnJava exists
Attaching patch and unit test to fix this on NativeException
There may be a better way to do this but it wasn't clear to me.
Unit test also included.