ext/rjbexception.c in rjb-1.6.0 vs ext/rjbexception.c in rjb-1.6.1
- old
+ new
@@ -27,11 +27,11 @@
#include "rjb.h"
static VALUE missing_delegate(int argc, VALUE* argv, VALUE self)
{
ID rmid = rb_to_id(argv[0]);
- return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rmid, argc - 1, argv + 1);
+ return rb_funcallv(rb_ivar_get(self, rb_intern("@cause")), rmid, argc - 1, argv + 1);
}
static VALUE get_cause(VALUE self)
{
return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rb_intern("cause"), 0);
@@ -41,11 +41,22 @@
{
if (argc < 1 || argc > 2)
{
rb_raise(rb_eArgError, "respond_to? require 1 or 2 arguments");
}
- return rb_to_id(argv[0]) == rb_intern("to_str") ? Qfalse : Qtrue;
+ if (rb_to_id(argv[0]) == rb_intern("to_str"))
+ {
+ return Qfalse;
+ }
+ else if (rb_to_id(argv[0]) == rb_intern("exception"))
+ {
+ return Qtrue;
+ }
+ else
+ {
+ return rb_funcallv(rb_ivar_get(self, rb_intern("@cause")), rb_intern("respond_to?"), argc, argv);
+ }
}
/*
* handle Java exception
* At this time, the Java exception is defined without the package name.
@@ -84,11 +95,11 @@
st_insert(RHASH_TBL(rjb_loaded_classes), cname, rexp);
#else
st_insert(RHASH(rjb_loaded_classes)->tbl, cname, rexp);
#endif
#endif
-
+
}
return rexp;
}
/*
@@ -96,10 +107,10 @@
*/
VALUE rjb_s_throw(int argc, VALUE* argv, VALUE self)
{
VALUE klass;
VALUE message;
- JNIEnv* jenv = NULL;
+ JNIEnv* jenv = NULL;
rjb_load_vm_default();
jenv = rjb_attach_current_thread();
(*jenv)->ExceptionClear(jenv);