diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-02 00:21:07 -0700 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-02 00:22:09 -0700 |
commit | 9e0a3d46b6eb176a3450d565c9e172eb22f9c8dc (patch) | |
tree | 5ba0e685e5357e8ad78d6e72b17e5688895ed6c9 /unix/modjni.c | |
parent | 90b1cc51039b9a8e728fd5ac1b8f083449b6a589 (diff) | |
download | micropython-9e0a3d46b6eb176a3450d565c9e172eb22f9c8dc.tar.gz micropython-9e0a3d46b6eb176a3450d565c9e172eb22f9c8dc.zip |
unix/modjni: Convert Java's IndexOutOfBoundsException to Python's IndexError.
Diffstat (limited to 'unix/modjni.c')
-rw-r--r-- | unix/modjni.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unix/modjni.c b/unix/modjni.c index 3e94c0e67d..fa1fd8ce99 100644 --- a/unix/modjni.c +++ b/unix/modjni.c @@ -55,6 +55,8 @@ static jmethodID List_get_mid; static jmethodID List_set_mid; static jmethodID List_size_mid; +static jclass IndexException_class; + STATIC const mp_obj_type_t jobject_type; STATIC const mp_obj_type_t jmethod_type; @@ -98,6 +100,9 @@ STATIC void check_exception(void) { //JJ1(ExceptionDescribe); mp_obj_t py_e = new_jobject(exc); JJ1(ExceptionClear); + if (JJ(IsInstanceOf, exc, IndexException_class)) { + nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, py_e)); + } nlr_raise(mp_obj_new_exception_arg1(&mp_type_Exception, py_e)); } } @@ -513,6 +518,7 @@ STATIC void create_jvm() { "(ILjava/lang/Object;)Ljava/lang/Object;"); List_size_mid = JJ(GetMethodID, List_class, "size", "()I"); + IndexException_class = JJ(FindClass, "java/lang/IndexOutOfBoundsException"); } STATIC mp_obj_t mod_jni_cls(mp_obj_t cls_name_in) { |