< 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,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:
@@ -65,23 +66,23 @@
return agentGotCapabilities;
}
#define ATTACH002_TARGET_APP_CLASS_NAME "nsk/jvmti/AttachOnDemand/attach002/attach002Target"
-int registerNativeMethods(JNIEnv* jni) {
+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);
- if (!NSK_JNI_VERIFY(jni, appClass != NULL)) {
+ appClass = jni->FindClass(ATTACH002_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 >