comparison test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.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 543a3fb81c4c
children c78a17d24618
comparison
equal deleted inserted replaced
2:192396195017 3:3d299d64fe33
68 static void doRedirect(JNIEnv *env) { 68 static void doRedirect(JNIEnv *env) {
69 jvmtiError err; 69 jvmtiError err;
70 70
71 if (verbose) 71 if (verbose)
72 printf("\ndoRedirect: obtaining the JNI function table ...\n"); 72 printf("\ndoRedirect: obtaining the JNI function table ...\n");
73 if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != 73 err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
74 JVMTI_ERROR_NONE) { 74 if (err != JVMTI_ERROR_NONE) {
75 result = STATUS_FAILED; 75 result = STATUS_FAILED;
76 printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", 76 printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
77 __FILE__, __LINE__, TranslateError(err)); 77 __FILE__, __LINE__, TranslateError(err));
78 env->FatalError("failed to get original JNI function table"); 78 env->FatalError("failed to get original JNI function table");
79 } 79 }
80 if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != 80 err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
81 JVMTI_ERROR_NONE) { 81 if (err != JVMTI_ERROR_NONE) {
82 result = STATUS_FAILED; 82 result = STATUS_FAILED;
83 printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", 83 printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
84 __FILE__, __LINE__, TranslateError(err)); 84 __FILE__, __LINE__, TranslateError(err));
85 env->FatalError("failed to get redirected JNI function table"); 85 env->FatalError("failed to get redirected JNI function table");
86 } 86 }
89 89
90 if (verbose) 90 if (verbose)
91 printf("\ndoRedirect: overwriting the function GetVersion() ...\n"); 91 printf("\ndoRedirect: overwriting the function GetVersion() ...\n");
92 redir_jni_functions->GetVersion = MyGetVersion; 92 redir_jni_functions->GetVersion = MyGetVersion;
93 93
94 if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) != 94 err = jvmti->SetJNIFunctionTable(redir_jni_functions);
95 JVMTI_ERROR_NONE) { 95 if (err != JVMTI_ERROR_NONE) {
96 result = STATUS_FAILED; 96 result = STATUS_FAILED;
97 printf("(%s,%d): TEST FAILED: failed to get new JNI function table: %s\n", 97 printf("(%s,%d): TEST FAILED: failed to get new JNI function table: %s\n",
98 __FILE__, __LINE__, TranslateError(err)); 98 __FILE__, __LINE__, TranslateError(err));
99 env->FatalError("failed to get new JNI function table"); 99 env->FatalError("failed to get new JNI function table");
100 } 100 }
106 static void doRestore(JNIEnv *env) { 106 static void doRestore(JNIEnv *env) {
107 jvmtiError err; 107 jvmtiError err;
108 108
109 if (verbose) 109 if (verbose)
110 printf("\ndoRestore: restoring the original JNI function table ...\n"); 110 printf("\ndoRestore: restoring the original JNI function table ...\n");
111 if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != 111 err = jvmti->SetJNIFunctionTable(orig_jni_functions);
112 JVMTI_ERROR_NONE) { 112 if (err != JVMTI_ERROR_NONE) {
113 result = STATUS_FAILED; 113 result = STATUS_FAILED;
114 printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", 114 printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
115 __FILE__, __LINE__, TranslateError(err)); 115 __FILE__, __LINE__, TranslateError(err));
116 env->FatalError("failed to restore original JNI function table"); 116 env->FatalError("failed to restore original JNI function table");
117 } 117 }
124 jvmtiError err; 124 jvmtiError err;
125 jint res; 125 jint res;
126 126
127 redir_calls = 0; 127 redir_calls = 0;
128 128
129 if ((err = jvmti->GetJNIFunctionTable(&tested_jni_functions)) != 129 err = jvmti->GetJNIFunctionTable(&tested_jni_functions);
130 JVMTI_ERROR_NONE) { 130 if (err != JVMTI_ERROR_NONE) {
131 result = STATUS_FAILED; 131 result = STATUS_FAILED;
132 printf("(%s,%d): TEST FAILED: failed to get modified JNI function table: %s\n", 132 printf("(%s,%d): TEST FAILED: failed to get modified JNI function table: %s\n",
133 __FILE__, __LINE__, TranslateError(err)); 133 __FILE__, __LINE__, TranslateError(err));
134 env->FatalError("failed to get modified JNI function table"); 134 env->FatalError("failed to get modified JNI function table");
135 } 135 }