1.1 --- a/src/share/vm/oops/instanceKlass.cpp Wed May 06 13:12:02 2015 -0700 1.2 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Feb 24 10:28:22 2014 +0100 1.3 @@ -50,6 +50,7 @@ 1.4 #include "prims/jvmtiExport.hpp" 1.5 #include "prims/jvmtiRedefineClassesTrace.hpp" 1.6 #include "prims/jvmtiRedefineClasses.hpp" 1.7 +#include "prims/jvmtiThreadState.hpp" 1.8 #include "prims/methodComparator.hpp" 1.9 #include "runtime/fieldDescriptor.hpp" 1.10 #include "runtime/handles.inline.hpp" 1.11 @@ -928,10 +929,16 @@ 1.12 // Step 10 and 11 1.13 Handle e(THREAD, PENDING_EXCEPTION); 1.14 CLEAR_PENDING_EXCEPTION; 1.15 + // JVMTI has already reported the pending exception 1.16 + // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError 1.17 + JvmtiExport::clear_detected_exception((JavaThread*)THREAD); 1.18 { 1.19 EXCEPTION_MARK; 1.20 this_oop->set_initialization_state_and_notify(initialization_error, THREAD); 1.21 CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below 1.22 + // JVMTI has already reported the pending exception 1.23 + // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError 1.24 + JvmtiExport::clear_detected_exception((JavaThread*)THREAD); 1.25 } 1.26 DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_oop()), -1,wait); 1.27 if (e->is_a(SystemDictionary::Error_klass())) {