Commit 46e9e48e authored by Larry Sachs's avatar Larry Sachs Committed by Rick Bell

Find java.util.ArrayList class at startup

java.util.ArrayList cannot be found if not running on the
main thread.  Only java.lang.* classes can be found if not
running on the main thread.  All other class references
must be found at startup for future use.

Change-Id: I51a7d0246bd4c2682e53d34990f8d078700b5f33
Signed-off-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/29392Tested-by: default avatarIoTivity Jenkins <jenkins-daemon@iotivity.org>
Reviewed-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent 7140b056
......@@ -38,6 +38,7 @@
/* Code and typemaps for mapping the oc_main_init to the java OCMainInitHandler */
%{
static jobject jinit_obj;
static jclass cls_ArrayList;
static jclass cls_OCMainInitHandler;
static jclass cls_OCAddDeviceHandler;
static jclass cls_OCClientResponse;
......@@ -295,6 +296,11 @@ int jni_main_init(const oc_handler_t *handler)
cls_OCObtStatusHandler = (jclass)(JCALL1(NewGlobalRef, jenv, ocObtStatusHandlerClass));
JCALL1(DeleteLocalRef, jenv, ocObtStatusHandlerClass);
jclass utilArrayListClass = JCALL1(FindClass, jenv, "java/util/ArrayList");
assert(utilArrayListClass);
cls_ArrayList = (jclass)(JCALL1(NewGlobalRef, jenv, utilArrayListClass));
JCALL1(DeleteLocalRef, jenv, utilArrayListClass);
ReleaseJNIEnv(getEnvResult);
// initialize threads
......@@ -611,7 +617,7 @@ SWIGEXPORT jobject JNICALL Java_org_iotivity_OCMainJNI_getQueryValues(JNIEnv *je
(void)jrequest_;
request = *(oc_request_t **)&jrequest;
jclass cls_ArrayList = JCALL1(FindClass, jenv, "java/util/ArrayList");
assert(cls_ArrayList);
jmethodID mid_arrayListConstructor = JCALL3(GetMethodID, jenv, cls_ArrayList, "<init>", "()V");
jmethodID mid_add = JCALL3(GetMethodID, jenv, cls_ArrayList, "add", "(Ljava/lang/Object;)Z");
......
Markdown is supported
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