Clearing pending exceptions in JNI env 59/177859/1
authorHarry <h.marappa@samsung.com>
Wed, 2 May 2018 13:33:34 +0000 (19:03 +0530)
committerAmit KS <amit.s12@samsung.com>
Fri, 4 May 2018 05:19:10 +0000 (10:49 +0530)
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/287
(cherry picked from commit 312f0a735dea35925da0d80a916d0d9cf542932e)

Change-Id: I2830f50706a5818375745a406d3ff4b7f8ecdb1c
Signed-off-by: Harry <h.marappa@samsung.com>
Signed-off-by: Amit KS <amit.s12@samsung.com>
resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c

index e584626..8f67d47 100644 (file)
@@ -436,6 +436,8 @@ static CAResult_t CAIPDestroyJniInterface()
         isAttached = true;
     }
 
+    CACheckJNIException(env);
+
     jclass jni_IpInterface = (*env)->FindClass(env, "org/iotivity/ca/CaIpInterface");
     if (!jni_IpInterface)
     {
@@ -454,11 +456,9 @@ static CAResult_t CAIPDestroyJniInterface()
 
     (*env)->CallStaticVoidMethod(env, jni_IpInterface, jni_InterfaceDestroyMethod);
 
-    if ((*env)->ExceptionCheck(env))
+    if (CACheckJNIException(env))
     {
         OIC_LOG(ERROR, TAG, "destroyIpInterface has failed");
-        (*env)->ExceptionDescribe(env);
-        (*env)->ExceptionClear(env);
         goto error_exit;
     }