8031583: warnings from b03 for hotspot/agent/src/os/solaris/proc: JNI exception pending
authordsamersoff
Thu, 28 Aug 2014 06:32:16 -0700
changeset 26410 a34c8032e674
parent 26409 9f717958a2bb
child 26411 8daa5fdf642f
child 26413 920381b1a54b
8031583: warnings from b03 for hotspot/agent/src/os/solaris/proc: JNI exception pending Summary: Added missed exception checks Reviewed-by: sla, sspitsyn
hotspot/agent/src/os/solaris/proc/saproc.cpp
--- a/hotspot/agent/src/os/solaris/proc/saproc.cpp	Thu Aug 28 10:28:21 2014 +0200
+++ b/hotspot/agent/src/os/solaris/proc/saproc.cpp	Thu Aug 28 06:32:16 2014 -0700
@@ -90,7 +90,9 @@
 */
 
 static void throwNewDebuggerException(JNIEnv* env, const char* errMsg) {
-  env->ThrowNew(env->FindClass("sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
+  jclass clazz = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException");
+  CHECK_EXCEPTION;
+  env->ThrowNew(clazz, errMsg);
 }
 
 // JNI ids for some fields, methods
@@ -962,6 +964,7 @@
   CHECK_EXCEPTION_(0);
   jboolean isCopy;
   jlong* ptr = env->GetLongArrayElements(res, &isCopy);
+  CHECK_EXCEPTION_(NULL);
   for (int i = 0; i < NPRGREG; i++) {
     ptr[i] = (jlong) (uintptr_t) gregs[i];
   }
@@ -1253,6 +1256,7 @@
   (JNIEnv *env, jobject this_object, jstring name) {
   jboolean isCopy;
   const char* ptr = env->GetStringUTFChars(name, &isCopy);
+  CHECK_EXCEPTION_(NULL);
   char  buf[2*SYMBOL_BUF_SIZE + 1];
   jstring res = 0;
   if (cplus_demangle((char*) ptr, buf, sizeof(buf)) != DEMANGLE_ESPACE) {
@@ -1439,7 +1443,9 @@
                             "createClosestSymbol", "(Ljava/lang/String;J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;");
   CHECK_EXCEPTION;
 
-  listAdd_ID = env->GetMethodID(env->FindClass("java/util/List"), "add", "(Ljava/lang/Object;)Z");
+  jclass list_clazz = env->FindClass("java/util/List");
+  CHECK_EXCEPTION;
+  listAdd_ID = env->GetMethodID(list_clazz, "add", "(Ljava/lang/Object;)Z");
   CHECK_EXCEPTION;
 
   // part of the class sharing workaround