6472925: OutOfMemoryError fails to generate stack trace as it now ought
authorcoleenp
Mon, 07 Feb 2011 14:36:26 -0500
changeset 8115 1b3ccddac0ab
parent 8112 77eb272084d9
child 8116 46f28ead0d96
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
hotspot/src/share/vm/runtime/thread.cpp
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Feb 03 20:30:19 2011 -0800
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon Feb 07 14:36:26 2011 -0500
@@ -1611,7 +1611,15 @@
                                   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;
+        }
       }
     }