ext/rjbexception.c in rjb-1.1.2 vs ext/rjbexception.c in rjb-1.1.3
- old
+ new
@@ -10,11 +10,11 @@
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: rjbexception.c 47 2007-12-28 06:39:43Z arton $
+ * $Id: rjbexception.c 64 2008-03-05 14:24:22Z kuwa1 $
*/
#include "ruby.h"
#include "extconf.h"
#if RJB_RUBY_VERSION_CODE < 190
@@ -64,10 +64,16 @@
*/
VALUE rjb_s_throw(int argc, VALUE* argv, VALUE self)
{
VALUE klass;
VALUE message;
- JNIEnv* jenv = rjb_attach_current_thread();
+ JNIEnv* jenv = NULL;
+
+ rjb_load_vm_default();
+
+ jenv = rjb_attach_current_thread();
+ (*jenv)->ExceptionClear(jenv);
+
if (rb_scan_args(argc, argv, "11", &klass, &message) == 2)
{
jclass excep = rjb_find_class(jenv, klass);
if (excep == NULL)
{