comparison test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp @ 53610:9cfc8b0c45fd

8214149: Move out assignments when not using NSK*VERIFY macros Summary: Move out the assignments from ifs Reviewed-by: sspitsyn, cjplummer
author jcbeyler
date Wed, 21 Nov 2018 10:46:45 -0800
parents cdfabab3413f
children
comparison
equal deleted inserted replaced
2:913dc4125a67 3:8d2867888926
43 43
44 if (verbose) 44 if (verbose)
45 printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n", 45 printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n",
46 TranslateError(exError)); 46 TranslateError(exError));
47 47
48 if ((err = jvmti->SetJNIFunctionTable(NULL)) != 48 err = jvmti->SetJNIFunctionTable(NULL);
49 exError) { 49 if (err != exError) {
50 result = STATUS_FAILED; 50 result = STATUS_FAILED;
51 printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n", 51 printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n",
52 __FILE__, __LINE__, TranslateError(err), TranslateError(exError)); 52 __FILE__, __LINE__, TranslateError(err), TranslateError(exError));
53 return; 53 return;
54 } 54 }
76 /* b) Verifying the error JVMTI_ERROR_UNATTACHED_THREAD 76 /* b) Verifying the error JVMTI_ERROR_UNATTACHED_THREAD
77 Note: the JNI spec says that the main thread can be detached from the VM 77 Note: the JNI spec says that the main thread can be detached from the VM
78 only since JDK 1.2 */ 78 only since JDK 1.2 */
79 if (verbose) 79 if (verbose)
80 printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n"); 80 printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
81 if ((res = vm->DetachCurrentThread()) != JNI_OK) { 81 res = vm->DetachCurrentThread();
82 if (res != JNI_OK) {
82 printf( 83 printf(
83 "(%s,%d): Warning: DetachCurrentThread() returns: %d\n" 84 "(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
84 "\tcheck with the detached main thread skipped\n", 85 "\tcheck with the detached main thread skipped\n",
85 __FILE__, __LINE__, res); 86 __FILE__, __LINE__, res);
86 } else { 87 } else {
87 redirect(env, JVMTI_ERROR_UNATTACHED_THREAD); 88 redirect(env, JVMTI_ERROR_UNATTACHED_THREAD);
88 89
89 if (verbose) 90 if (verbose)
90 printf("\nattaching the main thread back ...\n"); 91 printf("\nattaching the main thread back ...\n");
91 if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != JNI_OK) { 92 res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
93 if (res != JNI_OK) {
92 printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n", 94 printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
93 __FILE__, __LINE__, res); 95 __FILE__, __LINE__, res);
94 return STATUS_FAILED; 96 return STATUS_FAILED;
95 } 97 }
96 } 98 }