< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp
Print this page
rev 52432 : 8213501: Deploy ExceptionJniWrapper for a few tests
Summary:
Reviewed-by:
@@ -25,10 +25,11 @@
#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:
@@ -85,24 +86,24 @@
* Can't use JNI functions from ObjectFree event handler, in this test target application calls
* function nsk_aod_agentFinished
*/
}
-int registerNativeMethods(JNIEnv* jni) {
+int registerNativeMethods(JNIEnv* jni_env) {
+ ExceptionCheckingJniEnvPtr jni(jni_env);
jclass appClass;
JNINativeMethod nativeMethods[] = {
{(char*) "setTagFor", (char*) "(Ljava/lang/Object;)Z", (void*) Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_setTagFor},
{(char*) "shutdownAgent", (char*) "()V", (void*) Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_shutdownAgent}};
jint nativeMethodsNumber = 2;
- appClass = jni->FindClass(ATTACH021_TARGET_APP_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, appClass != NULL)) {
+ appClass = jni->FindClass(ATTACH021_TARGET_APP_CLASS_NAME, TRACE_JNI_CALL);
+ if (appClass == NULL) {
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY(jni,
- (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+ if (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber, TRACE_JNI_CALL) != 0) {
return NSK_FALSE;
}
return NSK_TRUE;
}
< prev index next >