test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp
changeset 54744 be7839b9493f
parent 52293 d01d4bd7c5b3
child 57629 7aba63ce3b3a
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp	Tue May 07 15:39:33 2019 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp	Tue May 07 07:43:41 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 #include <string.h>
 #include "jvmti.h"
 #include "agent_common.h"
+#include "ExceptionCheckingJniEnv.hpp"
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
@@ -451,6 +452,7 @@
 static void JNICALL
 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
 
+    ExceptionCheckingJniEnvPtr ec_jni(agentJNI);
     int i;
     jfieldID field_accID, field_modID;
     jclass cls;
@@ -459,17 +461,9 @@
     if (!nsk_jvmti_waitForSync(timeout))
         return;
 
-    cls = agentJNI->FindClass(CLASS_NAME);
-    if (!NSK_JNI_VERIFY(agentJNI, cls != NULL))
-        return;
-
-    field_accID = agentJNI->GetStaticFieldID(cls, FIELD_ACC_NAME, "I");
-    if (!NSK_JNI_VERIFY(agentJNI, field_accID != NULL))
-        return;
-
-    field_modID = agentJNI->GetStaticFieldID(cls, FIELD_MOD_NAME, "I");
-    if (!NSK_JNI_VERIFY(agentJNI, field_modID != NULL))
-        return;
+    cls = ec_jni->FindClass(CLASS_NAME, TRACE_JNI_CALL);
+    field_accID = ec_jni->GetStaticFieldID(cls, FIELD_ACC_NAME, "I", TRACE_JNI_CALL);
+    field_modID = ec_jni->GetStaticFieldID(cls, FIELD_MOD_NAME, "I", TRACE_JNI_CALL);
 
     if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(cls, field_modID)))
         return;