diff src/share/vm/runtime/thread.cpp @ 2200:fb539912d338

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
author coleenp
date Mon, 07 Feb 2011 14:36:26 -0500
parents 3582bf76420e
children 5197f3d713a1
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp	Thu Feb 03 20:30:19 2011 -0800
+++ b/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;
+        }
       }
     }