comparison src/share/vm/runtime/reflection.cpp @ 14481:016b6a289fc4

4505697: nsk/jdi/ExceptionEvent/_itself_/exevent006 and exevent008 tests fail with InvocationTargetException Reviewed-by: dcubed, dholmes, sspitsyn
author jbachorik
date Mon, 24 Feb 2014 10:28:22 +0100
parents 63a4eb8bcd23
children 4ca6dc0799b6
comparison
equal deleted inserted replaced
14480:61ab121722b8 14481:016b6a289fc4
34 #include "memory/universe.inline.hpp" 34 #include "memory/universe.inline.hpp"
35 #include "oops/instanceKlass.hpp" 35 #include "oops/instanceKlass.hpp"
36 #include "oops/objArrayKlass.hpp" 36 #include "oops/objArrayKlass.hpp"
37 #include "oops/objArrayOop.hpp" 37 #include "oops/objArrayOop.hpp"
38 #include "prims/jvm.h" 38 #include "prims/jvm.h"
39 #include "prims/jvmtiExport.hpp"
39 #include "runtime/arguments.hpp" 40 #include "runtime/arguments.hpp"
40 #include "runtime/handles.inline.hpp" 41 #include "runtime/handles.inline.hpp"
41 #include "runtime/javaCalls.hpp" 42 #include "runtime/javaCalls.hpp"
42 #include "runtime/reflection.hpp" 43 #include "runtime/reflection.hpp"
43 #include "runtime/reflectionUtils.hpp" 44 #include "runtime/reflectionUtils.hpp"
939 method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD); 940 method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
940 if (HAS_PENDING_EXCEPTION) { 941 if (HAS_PENDING_EXCEPTION) {
941 // Method resolution threw an exception; wrap it in an InvocationTargetException 942 // Method resolution threw an exception; wrap it in an InvocationTargetException
942 oop resolution_exception = PENDING_EXCEPTION; 943 oop resolution_exception = PENDING_EXCEPTION;
943 CLEAR_PENDING_EXCEPTION; 944 CLEAR_PENDING_EXCEPTION;
945 // JVMTI has already reported the pending exception
946 // JVMTI internal flag reset is needed in order to report InvocationTargetException
947 if (THREAD->is_Java_thread()) {
948 JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
949 }
944 JavaCallArguments args(Handle(THREAD, resolution_exception)); 950 JavaCallArguments args(Handle(THREAD, resolution_exception));
945 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 951 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
946 vmSymbols::throwable_void_signature(), 952 vmSymbols::throwable_void_signature(),
947 &args); 953 &args);
948 } 954 }
1071 1077
1072 if (HAS_PENDING_EXCEPTION) { 1078 if (HAS_PENDING_EXCEPTION) {
1073 // Method threw an exception; wrap it in an InvocationTargetException 1079 // Method threw an exception; wrap it in an InvocationTargetException
1074 oop target_exception = PENDING_EXCEPTION; 1080 oop target_exception = PENDING_EXCEPTION;
1075 CLEAR_PENDING_EXCEPTION; 1081 CLEAR_PENDING_EXCEPTION;
1082 // JVMTI has already reported the pending exception
1083 // JVMTI internal flag reset is needed in order to report InvocationTargetException
1084 if (THREAD->is_Java_thread()) {
1085 JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
1086 }
1087
1076 JavaCallArguments args(Handle(THREAD, target_exception)); 1088 JavaCallArguments args(Handle(THREAD, target_exception));
1077 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 1089 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1078 vmSymbols::throwable_void_signature(), 1090 vmSymbols::throwable_void_signature(),
1079 &args); 1091 &args);
1080 } else { 1092 } else {