8214149: Move out assignments when not using NSK*VERIFY macros
Summary: Move out the assignments from ifs
Reviewed-by: sspitsyn, cjplummer
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -36,7 +36,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -39,7 +39,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -41,7 +41,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -38,7 +38,8 @@
JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) {
JNIEnv* jni;
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -120,18 +120,22 @@
NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n");
}
- if ((i = findSig(sig, 1)) != -1) {
+ i = findSig(sig, 1);
+ if (i != -1) {
clsEvents[i]++;
NSK_DISPLAY1("CHECK PASSED: ClassLoad event received for the class \"%s\" as expected\n",
sig);
}
- else if ((i = findSig(sig, 0)) != -1) {
+ else {
+ i = findSig(sig, 0);
+ if (i != -1) {
result = STATUS_FAILED;
primClsEvents[i]++;
NSK_COMPLAIN1(
"TEST FAILED: JVMTI_EVENT_CLASS_LOAD event received for\n"
"\t a primitive class/array of primitive types with the signature \"%s\"\n",
sig);
+ }
}
unlock(jvmti_env, env);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -271,7 +271,8 @@
return;
}
- if ((err = (jvmti->GetCurrentThread(&prep_thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&prep_thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return;
@@ -298,7 +299,8 @@
return STATUS_FAILED;
}
- if ((err = (jvmti->GetCurrentThread(&prep_thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&prep_thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
return STATUS_FAILED;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -270,7 +270,8 @@
return STATUS_FAILED;
}
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -80,7 +80,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -63,7 +63,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -438,13 +438,15 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon001/contmon001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon001/contmon001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -58,7 +58,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon002/contmon002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon002/contmon002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -58,7 +58,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon003/contmon003.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon003/contmon003.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -63,7 +63,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -70,15 +70,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -91,8 +91,8 @@
printf("\ndoRedirect: overwriting the function GetVersion() ...\n");
redir_jni_functions->GetVersion = MyGetVersion;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -108,8 +108,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -126,8 +126,8 @@
redir_calls = 0;
- if ((err = jvmti->GetJNIFunctionTable(&tested_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&tested_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get modified JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -46,9 +46,8 @@
printf("\ntrying to get the JNI function table expecting the error %s to be returned ...\n",
TranslateError(exError));
- if ((err = jvmti->GetJNIFunctionTable(
- (exError==JVMTI_ERROR_NULL_POINTER)?NULL:&orig_jni_functions)) !=
- exError) {
+ err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? NULL : &orig_jni_functions);
+ if (err != exError) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: GetJNIFunctionTable() returns %s instead of %s as expected\n",
__FILE__, __LINE__, TranslateError(err), TranslateError(exError));
@@ -80,7 +79,8 @@
only since JDK 1.2 */
if (verbose)
printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
- if ((err = vm->DetachCurrentThread()) != 0) {
+ err = vm->DetachCurrentThread();
+ if (err != 0) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -90,7 +90,8 @@
if (verbose)
printf("\nattaching the main thread back ...\n");
- if ((err = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
+ err = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (err != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, err);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -122,7 +122,8 @@
Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon1(JNIEnv *env,
jclass cls, jint point, jthread thr, jobject lock) {
jobject *monitors;
- if ((monitors = getInfo(env, point, thr, 1)) == NULL) {
+ monitors = getInfo(env, point, thr, 1);
+ if (monitors == NULL) {
return;
}
if (!env->IsSameObject(lock, monitors[0])) {
@@ -135,7 +136,8 @@
Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon2(JNIEnv *env,
jclass cls, jint point, jthread thr, jobject lock1, jobject lock2) {
jobject *monitors;
- if ((monitors = getInfo(env, point, thr, 2)) == NULL) {
+ monitors = getInfo(env, point, thr, 2);
+ if (monitors == NULL) {
return;
}
if (!env->IsSameObject(lock1, monitors[0]) && !env->IsSameObject(lock2, monitors[0])) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat005/thrstat005.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat005/thrstat005.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -144,10 +144,19 @@
printf("checkThreadState: wait %d ms\n", waitTime);
fflush(stdout);
- if ((res = g_ppJvmtiEnv->RawMonitorEnter(g_waitMon)) != JVMTI_ERROR_NONE
- || (res = g_ppJvmtiEnv->RawMonitorWait(g_waitMon, waitTime)) != JVMTI_ERROR_NONE
- || (res = g_ppJvmtiEnv->RawMonitorExit(g_waitMon)) != JVMTI_ERROR_NONE) {
- reportError("GetThreadState: unexpected error", res);
+ res = g_ppJvmtiEnv->RawMonitorEnter(g_waitMon);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMontiorEnter", res);
+ return JNI_FALSE;
+ }
+ res = g_ppJvmtiEnv->RawMonitorWait(g_waitMon, waitTime);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMontiorWait", res);
+ return JNI_FALSE;
+ }
+ res = g_ppJvmtiEnv->RawMonitorExit(g_waitMon);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMonitorExit", res);
return JNI_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -87,7 +87,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -108,7 +109,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -147,7 +149,8 @@
printf(">>>>>>>> Invoke PopFrame()\n");
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -87,7 +87,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -108,7 +109,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -148,7 +150,8 @@
printf(">>>>>>>> Invoke PopFrame()\n");
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -88,7 +88,8 @@
printf(">>>>>>>> Invoke SuspendThread()\n");
fflush(stdout);
}
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -111,7 +112,8 @@
printf(">>>>>>>> Invoke ResumeThread()\n");
fflush(stdout);
}
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -160,7 +162,8 @@
}
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) == JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err == JVMTI_ERROR_NONE) {
printf("Check #%d FAILED: PopFrame() was unexpectedly done\n", t_case);
tot_result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_NO_MORE_FRAMES &&
@@ -278,7 +281,8 @@
jclass cls = env->GetObjectClass(frameThr);
jmethodID mid = NULL;
- if ((mid = env->GetMethodID(cls, "activeMethod", "()V")) == NULL) {
+ mid = env->GetMethodID(cls, "activeMethod", "()V");
+ if (mid == NULL) {
printf("TEST FAILURE: nativeMeth2(): Unable to get method ID\n");
tot_result = STATUS_FAILED;
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -40,7 +40,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -95,7 +96,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -113,7 +115,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumThread():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -147,7 +150,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -53,7 +53,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -110,7 +111,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
printf("Warning: unrestrictedly redefinition of classes is not implemented,\n"
"\tso the test has no results.\n");
@@ -137,14 +139,16 @@
jint intFld;
jlong longFld;
- if ((fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
+ fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
}
intFld = env->GetStaticIntField(redefCls, fid);
- if ((fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
+ fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -58,7 +58,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -115,7 +116,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
printf(
"Warning: unrestrictedly redefinition of classes is not implemented,\n"
@@ -147,7 +149,8 @@
const char *strFld = NULL;
/* get value of new instance field "intComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
+ fid = env->GetFieldID(redefCls, "intComplNewFld", "I");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"intComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
@@ -155,7 +158,8 @@
intFld = env->GetIntField(redefObj, fid);
/* get value of new instance field "longComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
+ fid = env->GetFieldID(redefCls, "longComplNewFld", "J");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"longComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
@@ -163,7 +167,8 @@
longFld = env->GetLongField(redefObj, fid);
/* get value of new instance field "stringComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;")) == NULL) {
+ fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"stringComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -106,7 +106,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -172,26 +173,27 @@
return PASSED;
}
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return STATUS_FAILED;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_LOAD, thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
}
- if ((err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_PREPARE, thread)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable JVMTI_EVENT_CLASS_PREPARE: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
@@ -207,7 +209,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -125,7 +126,8 @@
}
/* explode the bomb */
- if ((err = (jvmti->RedefineClasses(1, classDefPtr))) != JVMTI_ERROR_NULL_POINTER) {
+ err = jvmti->RedefineClasses(1, classDefPtr);
+ if (err != JVMTI_ERROR_NULL_POINTER) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tBut it should return the error JVMTI_ERROR_NULL_POINTER.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -77,7 +77,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -166,15 +167,14 @@
breakpoints[i].m_name, breakpoints[i].m_sign, breakpoints[i].loc);
}
- if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SetBreakpoint(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return STATUS_FAILED;
}
- err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_BREAKPOINT, NULL);
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable BREAKPOINT event: %s (%d)\n",
TranslateError(err), err);
@@ -210,7 +210,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -261,8 +262,8 @@
}
}
- if ((err = (jvmti->ClearBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) != JVMTI_ERROR_NOT_FOUND) {
+ err = jvmti->ClearBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err != JVMTI_ERROR_NOT_FOUND) {
printf(
"TEST FAILED: Breakpoint #%d in the %s method:\n"
"\tname=\"%s\"; signature=\"%s\"; location=%d was not cleared:\n"
@@ -282,8 +283,8 @@
breakpoints[i].loc, err, TranslateError(err));
}
- if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) == JVMTI_ERROR_DUPLICATE) {
+ err = jvmti->SetBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err == JVMTI_ERROR_DUPLICATE) {
printf(
"TEST FAILED: the function SetBreakpoint() returned the error %d: %s\n"
"\ti.e. the breakpoint #%d has not been really cleared.\n\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -114,7 +114,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -181,8 +182,8 @@
}
/* get the LocalVariableTable attribute */
- if ((err = (jvmti->GetLocalVariableTable(methodsInfo[i].mid,
- &count, &lv_table))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetLocalVariableTable(methodsInfo[i].mid, &count, &lv_table);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call GetLocalVariableTable(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tfor the%s%s method \"%s\", signature \"%s\"\n\n",
@@ -266,7 +267,8 @@
if (vrb)
printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -93,7 +93,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -159,8 +160,8 @@
}
/* get the LineNumberTable attribute */
- if ((err = (jvmti->GetLineNumberTable(methodsInfo[i].mid,
- &count, &ln_table))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetLineNumberTable(methodsInfo[i].mid, &count, &ln_table);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call GetLineNumberTable(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tfor the%s%s method \"%s\", signature \"%s\"\n\n",
@@ -241,7 +242,8 @@
if (vrb)
printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -102,7 +102,8 @@
}
/* to check if RedefineClasses is supported */
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -162,7 +162,8 @@
classBytes = (jbyteArray) env->NewGlobalRef(bytes);
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -77,7 +77,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -140,8 +141,8 @@
return PASSED;
}
- if ((err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable JVMTI_EVENT_NATIVE_METHOD_BIND: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
@@ -157,7 +158,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -76,7 +76,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -101,7 +101,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -113,7 +113,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -70,8 +70,8 @@
static void lock() {
jvmtiError err;
- if ((err = jvmti->RawMonitorEnter(countLock)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->RawMonitorEnter(countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: RawMonitorEnter returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
exit(STATUS_FAILED);
@@ -81,8 +81,8 @@
static void unlock() {
jvmtiError err;
- if ((err = jvmti->RawMonitorExit(countLock))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->RawMonitorExit(countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: RawMonitorExit returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
exit(STATUS_FAILED);
@@ -116,15 +116,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -137,8 +137,8 @@
printf("\ndoRedirect: overwriting the function MonitorEnter ...\n");
redir_jni_functions->MonitorEnter = MyMonitorEnter;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -154,8 +154,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -168,7 +168,8 @@
void doExec(JNIEnv *env, int thrNum) {
jint res;
- if ((res = env->MonitorEnter(clsObj)) != 0) {
+ res = env->MonitorEnter(clsObj);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: MonitorEnter() returns %d for thread #%d\n",
__FILE__, __LINE__, res, thrNum);
@@ -183,7 +184,8 @@
if (verbose)
printf("\ndoExec: thread #%d entered the monitor\n",
thrNum);
- if ((res = env->MonitorExit(clsObj)) != 0) {
+ res = env->MonitorExit(clsObj);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: MonitorExit() returns %d for thread #%d\n",
__FILE__, __LINE__, res, thrNum);
@@ -221,7 +223,8 @@
if (verbose)
printf("\nwaitingThread: thread #%d started\n\tattaching the thread to the VM ...\n",
indx);
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -231,7 +234,8 @@
doExec(env, indx);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: DetachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -252,7 +256,8 @@
if (verbose)
printf("\ngetObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
javaField, classSig);
- if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
+ fid = env->GetFieldID(_objCls, javaField, classSig);
+ if (fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: failed to get ID for the field \"%s\"\n",
__FILE__, __LINE__, javaField);
@@ -326,7 +331,8 @@
return STATUS_FAILED;
}
- if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
+ clsObj = env->NewGlobalRef(getObjectFromField(env, obj));
+ if (clsObj == NULL) {
printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
__FILE__, __LINE__, classSig);
env->FatalError("failed to create a new global reference");
@@ -351,7 +357,8 @@
if (verbose)
printf("\nb) Checking the assertion inside main thread detached and attached again ...\n\ndetaching the main thread ...\n");
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -359,7 +366,8 @@
} else {
if (verbose)
printf("\nattaching the main thread again ...\n");
- if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -419,8 +427,8 @@
vm = jvm;
- if ((err = jvmti->CreateRawMonitor("_counter_lock",
- &countLock)) != JVMTI_ERROR_NONE) {
+ err = jvmti->CreateRawMonitor("_counter_lock", &countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: CreateRawMonitor() returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -45,8 +45,8 @@
printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n",
TranslateError(exError));
- if ((err = jvmti->SetJNIFunctionTable(NULL)) !=
- exError) {
+ err = jvmti->SetJNIFunctionTable(NULL);
+ if (err != exError) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n",
__FILE__, __LINE__, TranslateError(err), TranslateError(exError));
@@ -78,7 +78,8 @@
only since JDK 1.2 */
if (verbose)
printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
- if ((res = vm->DetachCurrentThread()) != JNI_OK) {
+ res = vm->DetachCurrentThread();
+ if (res != JNI_OK) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -88,7 +89,8 @@
if (verbose)
printf("\nattaching the main thread back ...\n");
- if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != JNI_OK) {
+ res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (res != JNI_OK) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -108,7 +108,8 @@
if (jni->IsSameObject(thread, thr) &&
jni->IsSameObject(object_M, obj)) {
- if (!(line = findLineNumber(jvmti, thread))) {
+ line = findLineNumber(jvmti, thread);
+ if (!line) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN2("MonitorContendedEnter event: thread=%p, object=%p\n",
thr, obj);
@@ -152,7 +153,8 @@
if (jni->IsSameObject(thread, thr) &&
jni->IsSameObject(object_M, obj)) {
- if (!(line = findLineNumber(jvmti, thread))) {
+ line = findLineNumber(jvmti, thread);
+ if (!line) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN2("MonitorContendedEntered event: thread=%p, object=%p\n",
thr, obj);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -100,7 +100,8 @@
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
- if ((myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) {
+ myTestClass = (jclass) jni_env->NewGlobalRef(klass);
+ if (myTestClass == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -63,16 +63,16 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
result = STATUS_FAILED;
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get redirected JNI function table");
@@ -83,8 +83,8 @@
redir_jni_functions->GetVersion = MyGetVersion;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to set new JNI function table");
@@ -100,8 +100,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to restore original JNI function table");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -98,15 +98,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -137,8 +137,8 @@
if (verbose)
printf("\ndoRedirect: obtaining field ID for \"%s\"...\n",
meth_info[i].f_name);
- if ((meth_info[i].fid = env->GetStaticFieldID(
- cls, meth_info[i].f_name, "I")) == 0) {
+ meth_info[i].fid = env->GetStaticFieldID(cls, meth_info[i].f_name, "I");
+ if (meth_info[i].fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get ID for the field %s\n",
__FILE__, __LINE__, meth_info[i].f_name);
@@ -159,8 +159,8 @@
}
}
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -176,8 +176,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -103,15 +103,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -126,8 +126,8 @@
redir_jni_functions->ThrowNew = MyThrowNew;
redir_jni_functions->ExceptionOccurred = MyExceptionOccurred;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -143,8 +143,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -157,7 +157,8 @@
void doExc(JNIEnv *env, jthrowable thrw, jclass thrCls, const char *msg) {
jint res;
- if ((res = env->ThrowNew(thrCls, msg)) != 0) {
+ res = env->ThrowNew(thrCls, msg);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to throw new exception\n",
__FILE__, __LINE__);
@@ -176,7 +177,8 @@
__FILE__, __LINE__, msg);
}
- if ((res = env->Throw(thrw)) != 0) {
+ res = env->Throw(thrw);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to throw exception\n",
__FILE__, __LINE__);
@@ -264,7 +266,8 @@
if (verbose)
printf("\ncheck: obtaining field ID for \"name=%s signature=%s\"...\n",
javaField, excClassSig);
- if ((fid = env->GetFieldID(objCls, javaField, excClassSig)) == 0) {
+ fid = env->GetFieldID(objCls, javaField, excClassSig);
+ if (fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get ID for the field \"%s\"\n",
__FILE__, __LINE__, javaField);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -78,13 +78,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -98,8 +100,8 @@
redir_jni_functions->AllocObject = MyAllocObject;
redir_jni_functions->NewObjectV = MyNewObjectV;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -115,7 +117,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -130,8 +133,8 @@
jobject newObj;
va_list args;
va_start(args, msg);
- if ((allObj = env->AllocObject(allCls))
- == NULL) {
+ allObj = env->AllocObject(allCls);
+ if (allObj == NULL) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n",
__FILE__, __LINE__, msg);
@@ -211,14 +214,15 @@
return STATUS_FAILED;
}
- if ((objCls = env->FindClass(classSig)) == NULL) {
+ objCls = env->FindClass(classSig);
+ if (objCls == NULL) {
printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n",
__FILE__, __LINE__, classSig);
return STATUS_FAILED;
}
- if ((ctorId = env->GetMethodID(objCls, "<init>", "()V"))
- == NULL) {
+ ctorId = env->GetMethodID(objCls, "<init>", "()V");
+ if (ctorId == NULL) {
printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n",
__FILE__, __LINE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -99,13 +99,15 @@
NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n",
(indx==0)?"first":"second");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
@@ -119,7 +121,8 @@
redir_jni_functions[indx]->GetVersion =
(indx==0)?MyGetVersionA:MyGetVersionB;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
@@ -194,8 +197,8 @@
callbacks.VMInit = &VMInitB;
break;
}
- if ((err = jvmti[indx]->SetEventCallbacks(
- &callbacks, sizeof(callbacks))) != JVMTI_ERROR_NONE) {
+ err = jvmti[indx]->SetEventCallbacks(&callbacks, sizeof(callbacks));
+ if (err != JVMTI_ERROR_NONE) {
NSK_COMPLAIN1("TEST FAILURE: failed to set event callbacks: %s\n",
TranslateError(err));
result = STATUS_FAILED;
@@ -204,8 +207,8 @@
NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n",
(indx==0)?"A":"B");
- if ((err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL)) != JVMTI_ERROR_NONE) { /* enable event globally */
+ err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+ if (err != JVMTI_ERROR_NONE) { /* enable event globally */
NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n",
(indx==0)?"A":"B", TranslateError(err));
result = STATUS_FAILED;
@@ -255,7 +258,8 @@
int exitCode = PASSED;
NSK_DISPLAY0("\nthe agent A started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res);
exit(STATUS_FAILED);
}
@@ -304,7 +308,8 @@
NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n",
exitCode);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res);
}
return exitCode;
@@ -318,7 +323,8 @@
int exitCode = PASSED;
NSK_DISPLAY0("\nthe agent B started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n",
res);
exit(STATUS_FAILED);
@@ -366,7 +372,8 @@
NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n",
exitCode);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res);
}
return exitCode;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -106,7 +106,8 @@
static jint enterMonitor(JNIEnv *env, const char *thr) {
jint result;
- if ((result = env->MonitorEnter(clsObj)) != 0) {
+ result = env->MonitorEnter(clsObj);
+ if (result != 0) {
NSK_COMPLAIN2("TEST FAILURE: %s: MonitorEnter() returns: %d\n",
thr, result);
return STATUS_FAILED;
@@ -125,7 +126,8 @@
static jint exitMonitor(JNIEnv *env, const char *thr) {
jint result;
- if ((result = env->MonitorExit(clsObj)) != 0) {
+ result = env->MonitorExit(clsObj);
+ if (result != 0) {
NSK_COMPLAIN2("TEST FAILURE: %s: MonitorExit() returns: %d\n",
thr, result);
return STATUS_FAILED;
@@ -138,15 +140,15 @@
jvmtiError err;
NSK_DISPLAY0("doRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to get original JNI function table: %s\n",
TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to get redirected JNI function table: %s\n",
TranslateError(err));
@@ -158,8 +160,8 @@
redir_jni_functions->MonitorEnter = MyMonitorEnter;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to set new JNI function table: %s\n",
TranslateError(err));
@@ -198,7 +200,8 @@
"waitingThread: thread #%d started\n"
"\tattaching the thread to the VM ...\n",
indx);
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -229,7 +232,8 @@
int tries = 0;
NSK_DISPLAY0("ownerThread: thread started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: ownerThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -270,7 +274,8 @@
int tries = 0;
NSK_DISPLAY0("redirectorThread: thread started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: redirectorThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -294,7 +299,8 @@
NSK_DISPLAY2("getObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
javaField, classSig);
- if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
+ fid = env->GetFieldID(_objCls, javaField, classSig);
+ if (fid == 0) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILURE: failed to get ID for the field \"%s\"\n",
javaField);
@@ -322,7 +328,8 @@
}
/* prepare the testing */
- if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
+ clsObj = env->NewGlobalRef(getObjectFromField(env, obj));
+ if (clsObj == NULL) {
NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
classSig);
env->FatalError("failed to create a new global reference");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -85,8 +85,8 @@
}
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(earlyretThr)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(earlyretThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -106,8 +106,8 @@
}
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(earlyretThr)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(earlyretThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -168,8 +168,8 @@
}
printf("After call to GetMethodID(%s, %s)\n", name_exp, sig_exp);
- if ((err = (jvmti->ForceEarlyReturnLong(earlyretThr, valToRet)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->ForceEarlyReturnLong(earlyretThr, valToRet);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function ForceEarlyReturn()"
" returned the error %d: %s\n",
err, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -110,7 +110,8 @@
printdump = JNI_TRUE;
}
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -149,15 +150,15 @@
return JNI_ERR;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_VM_INIT: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -581,8 +581,8 @@
jbyteArray classBytes;
jboolean isCopy;
- if ((_clsInfo = (class_info*)
- malloc(sizeof(class_info))) == NULL)
+ _clsInfo = (class_info*) malloc(sizeof(class_info));
+ if (_clsInfo == NULL)
jni_env->FatalError("JVMTIagent: cannot allocate memory for class_info\n");
/* fill the structure class_info */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -237,7 +237,8 @@
return JNI_FALSE;
}
- if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) {
+ pRefRec = findRefToVerify(tagFrom, tagTo, refKind);
+ if (pRefRec != NULL) {
pRefRec->_expectedCount += count;
return JNI_TRUE;
}
@@ -249,7 +250,8 @@
{
RefToVerify * pRefRec;
- if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) {
+ pRefRec = findRefToVerify(tagFrom, tagTo, refKind);
+ if (pRefRec != NULL) {
pRefRec->_actualCount++;
return JNI_TRUE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -41,7 +41,8 @@
}
FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError");
- if ((stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass)) == NULL) {
+ stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass);
+ if (stackOverflowErrorClass == NULL) {
printf("Can't create global ref for stack overflow class\n");
return 0;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -43,7 +43,8 @@
}
FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError");
- if ((stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass)) == NULL) {
+ stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass);
+ if (stackOverflowErrorClass == NULL) {
printf("Can't create global ref for stack overflow class\n");
return 0;
}
--- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp Wed Nov 21 18:44:11 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp Wed Nov 21 10:46:45 2018 -0800
@@ -147,7 +147,8 @@
static const char* name = "DBGHELP.DLL";
printf("# TEST: creating Windows minidump...\n");
- if ((size = GetSystemDirectory(path, pathLen)) > 0) {
+ size = GetSystemDirectory(path, pathLen);
+ if (size > 0) {
strcat(path, "\\");
strcat(path, name);
dbghelp = LoadLibrary(path);
@@ -158,12 +159,15 @@
}
// try Windows directory
- if (dbghelp == NULL && ((size = GetWindowsDirectory(path, pathLen)) > 6)) {
- strcat(path, "\\");
- strcat(path, name);
- dbghelp = LoadLibrary(path);
- if (dbghelp == NULL) {
- reportLastError("Load DBGHELP.DLL from Windows directory");
+ if (dbghelp == NULL) {
+ size = GetWindowsDirectory(path, pathLen);
+ if (size > 6) {
+ strcat(path, "\\");
+ strcat(path, name);
+ dbghelp = LoadLibrary(path);
+ if (dbghelp == NULL) {
+ reportLastError("Load DBGHELP.DLL from Windows directory");
+ }
}
}
if (dbghelp == NULL) {