8035829: [parfait] JNI exception pending in jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
authorjbachorik
Fri, 18 Jul 2014 17:23:28 +0200
changeset 25657 659ec6a877c0
parent 25656 676435b3c625
child 25658 7a6a01c13279
8035829: [parfait] JNI exception pending in jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c Reviewed-by: sundar, kevinw
jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Fri Jul 18 17:04:10 2014 +0400
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Fri Jul 18 17:23:28 2014 +0200
@@ -388,6 +388,7 @@
     if (argsLen > 0) {
         if (argsLen > MAX_ARGS) {
             JNU_ThrowInternalError(env, "Too many arguments");
+            return;
         }
         for (i=0; i<argsLen; i++) {
             jobject obj = (*env)->GetObjectArrayElement(env, args, i);
@@ -423,6 +424,8 @@
     stubLen = (DWORD)(*env)->GetArrayLength(env, stub);
     stubCode = (*env)->GetByteArrayElements(env, stub, &isCopy);
 
+    if ((*env)->ExceptionOccurred(env)) return;
+
     pCode = (PDWORD) VirtualAllocEx( hProcess, 0, stubLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
     if (pCode == NULL) {
         JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
@@ -592,6 +595,8 @@
         cstr[0] = '\0';
     } else {
         str = JNU_GetStringPlatformChars(env, jstr, &isCopy);
+        if ((*env)->ExceptionOccurred(env)) return;
+
         strncpy(cstr, str, len);
         cstr[len-1] = '\0';
         if (isCopy) {