Commit c4489a05 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/modjni: Propagate Java exceptions on list access.

parent 0eba162a
...@@ -92,6 +92,16 @@ STATIC bool is_object_type(const char *jtypesig) { ...@@ -92,6 +92,16 @@ STATIC bool is_object_type(const char *jtypesig) {
return false; return false;
} }
STATIC void check_exception(void) {
jobject exc = JJ1(ExceptionOccurred);
if (exc) {
//JJ1(ExceptionDescribe);
mp_obj_t py_e = new_jobject(exc);
JJ1(ExceptionClear);
nlr_raise(mp_obj_new_exception_arg1(&mp_type_Exception, py_e));
}
}
// jclass // jclass
STATIC void jclass_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { STATIC void jclass_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
...@@ -200,6 +210,9 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) ...@@ -200,6 +210,9 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
} else if (value == MP_OBJ_SENTINEL) { } else if (value == MP_OBJ_SENTINEL) {
// load // load
jobject el = JJ(CallObjectMethod, self->obj, List_get_mid, idx); jobject el = JJ(CallObjectMethod, self->obj, List_get_mid, idx);
if (el == NULL) {
check_exception();
}
return new_jobject(el); return new_jobject(el);
} else { } else {
// store // store
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment