comparison src/share/vm/runtime/reflection.cpp @ 23007:3c8b53552a43

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 2373a1f4987c
children dd9cc155639c 32b682649973
comparison
equal deleted inserted replaced
22997:ade5be2b1758 23007:3c8b53552a43
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"
940 method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD); 941 method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
941 if (HAS_PENDING_EXCEPTION) { 942 if (HAS_PENDING_EXCEPTION) {
942 // Method resolution threw an exception; wrap it in an InvocationTargetException 943 // Method resolution threw an exception; wrap it in an InvocationTargetException
943 oop resolution_exception = PENDING_EXCEPTION; 944 oop resolution_exception = PENDING_EXCEPTION;
944 CLEAR_PENDING_EXCEPTION; 945 CLEAR_PENDING_EXCEPTION;
946 // JVMTI has already reported the pending exception
947 // JVMTI internal flag reset is needed in order to report InvocationTargetException
948 if (THREAD->is_Java_thread()) {
949 JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
950 }
945 JavaCallArguments args(Handle(THREAD, resolution_exception)); 951 JavaCallArguments args(Handle(THREAD, resolution_exception));
946 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 952 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
947 vmSymbols::throwable_void_signature(), 953 vmSymbols::throwable_void_signature(),
948 &args); 954 &args);
949 } 955 }
1072 1078
1073 if (HAS_PENDING_EXCEPTION) { 1079 if (HAS_PENDING_EXCEPTION) {
1074 // Method threw an exception; wrap it in an InvocationTargetException 1080 // Method threw an exception; wrap it in an InvocationTargetException
1075 oop target_exception = PENDING_EXCEPTION; 1081 oop target_exception = PENDING_EXCEPTION;
1076 CLEAR_PENDING_EXCEPTION; 1082 CLEAR_PENDING_EXCEPTION;
1083 // JVMTI has already reported the pending exception
1084 // JVMTI internal flag reset is needed in order to report InvocationTargetException
1085 if (THREAD->is_Java_thread()) {
1086 JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
1087 }
1088
1077 JavaCallArguments args(Handle(THREAD, target_exception)); 1089 JavaCallArguments args(Handle(THREAD, target_exception));
1078 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(), 1090 THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1079 vmSymbols::throwable_void_signature(), 1091 vmSymbols::throwable_void_signature(),
1080 &args); 1092 &args);
1081 } else { 1093 } else {