8036609: Check jdk/src/windows/native/java/lang/ProcessImpl_md.c for JNI pending exceptions
authormsheppar
Thu, 20 Mar 2014 21:14:51 +0000 (2014-03-20)
changeset 23557 fdb248aa4e92
parent 23556 1726e34c34e8
child 23558 98f5dc16eb9b
8036609: Check jdk/src/windows/native/java/lang/ProcessImpl_md.c for JNI pending exceptions Summary: added ExceptionCheck fater JNI calls Reviewed-by: chegar
jdk/src/windows/native/java/lang/ProcessImpl_md.c
--- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Thu Mar 20 21:03:43 2014 +0000
+++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Thu Mar 20 21:14:51 2014 +0000
@@ -359,24 +359,28 @@
             const jchar *penvBlock = (envBlock != NULL)
                 ? (*env)->GetStringChars(env, envBlock, NULL)
                 : NULL;
-            const jchar *pdir = (dir != NULL)
-                ? (*env)->GetStringChars(env, dir, NULL)
-                : NULL;
-            jlong *handles = (*env)->GetLongArrayElements(env, stdHandles, NULL);
-            if (handles != NULL) {
-                ret = processCreate(
-                    env,
-                    pcmd,
-                    penvBlock,
-                    pdir,
-                    handles,
-                    redirectErrorStream);
-                (*env)->ReleaseLongArrayElements(env, stdHandles, handles, 0);
+            if (!(*env)->ExceptionCheck(env)) {
+                const jchar *pdir = (dir != NULL)
+                    ? (*env)->GetStringChars(env, dir, NULL)
+                    : NULL;
+                if (!(*env)->ExceptionCheck(env)) {
+                    jlong *handles = (*env)->GetLongArrayElements(env, stdHandles, NULL);
+                    if (handles != NULL) {
+                        ret = processCreate(
+                            env,
+                            pcmd,
+                            penvBlock,
+                            pdir,
+                            handles,
+                            redirectErrorStream);
+                        (*env)->ReleaseLongArrayElements(env, stdHandles, handles, 0);
+                    }
+                    if (pdir != NULL)
+                        (*env)->ReleaseStringChars(env, dir, pdir);
+                }
+                if (penvBlock != NULL)
+                    (*env)->ReleaseStringChars(env, envBlock, penvBlock);
             }
-            if (pdir != NULL)
-                (*env)->ReleaseStringChars(env, dir, pdir);
-            if (penvBlock != NULL)
-                (*env)->ReleaseStringChars(env, envBlock, penvBlock);
             (*env)->ReleaseStringChars(env, cmd, pcmd);
         }
     }
@@ -448,7 +452,7 @@
 JNIEXPORT jboolean JNICALL
 Java_java_lang_ProcessImpl_closeHandle(JNIEnv *env, jclass ignored, jlong handle)
 {
-    return CloseHandle((HANDLE) handle);
+    return (jboolean) CloseHandle((HANDLE) handle);
 }
 
 /**