From 7f04da98249c1404ece5cc80ef02a9b08d56e81d Mon Sep 17 00:00:00 2001 From: coleenp Date: Mon, 7 Feb 2011 14:36:26 -0500 Subject: [PATCH] 6472925: OutOfMemoryError fails to generate stack trace as it now ought Summary: Print an additional message for OOM during stack trace printing Reviewed-by: dholmes, phh, acorn, kamg, dcubed --- src/share/vm/runtime/thread.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 93eb9df19..2d61c80e4 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -1611,7 +1611,15 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { uncaught_exception, // Arg 2 THREAD); } - CLEAR_PENDING_EXCEPTION; + if (HAS_PENDING_EXCEPTION) { + ResourceMark rm(this); + jio_fprintf(defaultStream::error_stream(), + "\nException: %s thrown from the UncaughtExceptionHandler" + " in thread \"%s\"\n", + Klass::cast(pending_exception()->klass())->external_name(), + get_thread_name()); + CLEAR_PENDING_EXCEPTION; + } } } -- GitLab