1.1 --- a/src/share/vm/runtime/reflection.cpp Wed May 06 13:12:02 2015 -0700 1.2 +++ b/src/share/vm/runtime/reflection.cpp Mon Feb 24 10:28:22 2014 +0100 1.3 @@ -36,6 +36,7 @@ 1.4 #include "oops/objArrayKlass.hpp" 1.5 #include "oops/objArrayOop.hpp" 1.6 #include "prims/jvm.h" 1.7 +#include "prims/jvmtiExport.hpp" 1.8 #include "runtime/arguments.hpp" 1.9 #include "runtime/handles.inline.hpp" 1.10 #include "runtime/javaCalls.hpp" 1.11 @@ -942,6 +943,11 @@ 1.12 // Method resolution threw an exception; wrap it in an InvocationTargetException 1.13 oop resolution_exception = 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 InvocationTargetException 1.17 + if (THREAD->is_Java_thread()) { 1.18 + JvmtiExport::clear_detected_exception((JavaThread*) THREAD); 1.19 + } 1.20 JavaCallArguments args(Handle(THREAD, resolution_exception)); 1.21 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 1.22 vmSymbols::throwable_void_signature(), 1.23 @@ -1074,6 +1080,12 @@ 1.24 // Method threw an exception; wrap it in an InvocationTargetException 1.25 oop target_exception = PENDING_EXCEPTION; 1.26 CLEAR_PENDING_EXCEPTION; 1.27 + // JVMTI has already reported the pending exception 1.28 + // JVMTI internal flag reset is needed in order to report InvocationTargetException 1.29 + if (THREAD->is_Java_thread()) { 1.30 + JvmtiExport::clear_detected_exception((JavaThread*) THREAD); 1.31 + } 1.32 + 1.33 JavaCallArguments args(Handle(THREAD, target_exception)); 1.34 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 1.35 vmSymbols::throwable_void_signature(),