Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/vm/jni.h   |    1 +
 vm/jni-interface.c |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/vm/jni.h b/include/vm/jni.h
index 3b8acea..5512b26 100644
--- a/include/vm/jni.h
+++ b/include/vm/jni.h
@@ -39,6 +39,7 @@ typedef uint64_t jdouble;
 typedef jint jsize;
 
 typedef struct vm_object *jobject;
+typedef jobject jarray;
 typedef jobject jclass;
 typedef jobject jthrowable;
 typedef struct vm_field *jfieldID;
diff --git a/vm/jni-interface.c b/vm/jni-interface.c
index a3d367e..5766af6 100644
--- a/vm/jni-interface.c
+++ b/vm/jni-interface.c
@@ -788,6 +788,16 @@ vm_jni_new_object_array(struct vm_jni_env *env, jsize size,
        return array;
 }
 
+static jsize vm_jni_get_array_length(struct vm_jni_env *env, jarray array)
+{
+       if (!vm_class_is_array_class(array->class)) {
+               warn("argument is not an array");
+               return 0;
+       }
+
+       return array->array_length;
+}
+
 /*
  * The JNI native interface table.
  * See: http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/functions.html
@@ -1033,7 +1043,7 @@ void *vm_jni_native_interface[] = {
 
        /* 170 */
        vm_release_string_utf_chars,
-       NULL, /* GetArrayLength */
+       vm_jni_get_array_length,
        vm_jni_new_object_array,
        NULL, /* GetObjectArrayElement */
        NULL, /* SetObjectArrayElement */
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to