diff options
Diffstat (limited to 'runtime/thread.cc')
| -rw-r--r-- | runtime/thread.cc | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index 76f316149b..33267364e5 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -55,6 +55,7 @@ #include "mirror/object_array-inl.h" #include "mirror/stack_trace_element.h" #include "monitor.h" +#include "native_stack_dump.h" #include "nth_caller_visitor.h" #include "oat_quick_method_header.h" #include "object_lock.h" @@ -1817,22 +1818,12 @@ void Thread::HandleUncaughtExceptions(ScopedObjectAccess& soa) { ScopedLocalRef<jthrowable> exception(tlsPtr_.jni_env, tlsPtr_.jni_env->ExceptionOccurred()); tlsPtr_.jni_env->ExceptionClear(); - // If the thread has its own handler, use that. - ScopedLocalRef<jobject> handler(tlsPtr_.jni_env, - tlsPtr_.jni_env->GetObjectField(peer.get(), - WellKnownClasses::java_lang_Thread_uncaughtHandler)); - if (handler.get() == nullptr) { - // Otherwise use the thread group's default handler. - handler.reset(tlsPtr_.jni_env->GetObjectField(peer.get(), - WellKnownClasses::java_lang_Thread_group)); - } - - // Call the handler. - tlsPtr_.jni_env->CallVoidMethod(handler.get(), - WellKnownClasses::java_lang_Thread__UncaughtExceptionHandler_uncaughtException, - peer.get(), exception.get()); + // Call the Thread instance's dispatchUncaughtException(Throwable) + tlsPtr_.jni_env->CallVoidMethod(peer.get(), + WellKnownClasses::java_lang_Thread_dispatchUncaughtException, + exception.get()); - // If the handler threw, clear that exception too. + // If the dispatchUncaughtException threw, clear that exception too. tlsPtr_.jni_env->ExceptionClear(); } |