< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp

Print this page
rev 52432 : 8213501: Deploy ExceptionJniWrapper for a few tests
Summary:
Reviewed-by:

*** 25,34 **** --- 25,35 ---- #include <string.h> #include <jni.h> #include <jvmti.h> #include <aod.h> #include <jvmti_aod.h> + #include "ExceptionCheckingJniEnv.hpp" extern "C" { /* * Expected agent work scenario:
*** 65,87 **** return agentGotCapabilities; } #define ATTACH002_TARGET_APP_CLASS_NAME "nsk/jvmti/AttachOnDemand/attach002/attach002Target" ! int registerNativeMethods(JNIEnv* jni) { jclass appClass; JNINativeMethod nativeMethods[] = { {(char*) "agentGotCapabilities", (char*) "()Z", (void*) Java_nsk_jvmti_AttachOnDemand_attach002_attach002Target_agentGotCapabilities}}; jint nativeMethodsNumber = 1; ! appClass = jni->FindClass(ATTACH002_TARGET_APP_CLASS_NAME); ! if (!NSK_JNI_VERIFY(jni, appClass != NULL)) { return NSK_FALSE; } ! if (!NSK_JNI_VERIFY(jni, ! (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) { return NSK_FALSE; } return NSK_TRUE; } --- 66,88 ---- return agentGotCapabilities; } #define ATTACH002_TARGET_APP_CLASS_NAME "nsk/jvmti/AttachOnDemand/attach002/attach002Target" ! int registerNativeMethods(JNIEnv* jni_env) { ! ExceptionCheckingJniEnvPtr jni(jni_env); jclass appClass; JNINativeMethod nativeMethods[] = { {(char*) "agentGotCapabilities", (char*) "()Z", (void*) Java_nsk_jvmti_AttachOnDemand_attach002_attach002Target_agentGotCapabilities}}; jint nativeMethodsNumber = 1; ! appClass = jni->FindClass(ATTACH002_TARGET_APP_CLASS_NAME, TRACE_JNI_CALL); ! if (appClass == NULL) { return NSK_FALSE; } ! if (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber, TRACE_JNI_CALL) != 0) { return NSK_FALSE; } return NSK_TRUE; }
< prev index next >