changeset 1070:fcb148c6b605

6889302: TraceExceptions output should include detail message Reviewed-by: twisti, jrose, kvn
author never
date Tue, 13 Oct 2009 16:29:31 -0700
parents 354d3184f6b2
children 5f29a958a545
files src/share/vm/utilities/exceptions.cpp src/share/vm/utilities/exceptions.hpp
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/utilities/exceptions.cpp	Tue Oct 13 12:04:21 2009 -0700
+++ b/src/share/vm/utilities/exceptions.cpp	Tue Oct 13 16:29:31 2009 -0700
@@ -103,15 +103,18 @@
   _throw(thread, file, line, h_exception);
 }
 
-void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception) {
+void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
   assert(h_exception() != NULL, "exception should not be NULL");
 
   // tracing (do this up front - so it works during boot strapping)
   if (TraceExceptions) {
     ttyLocker ttyl;
     ResourceMark rm;
-    tty->print_cr("Exception <%s> (" INTPTR_FORMAT " ) \nthrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
-                      h_exception->print_value_string(), (address)h_exception(), file, line, thread);
+    tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n"
+                  "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
+                  h_exception->print_value_string(),
+                  message ? ": " : "", message ? message : "",
+                  (address)h_exception(), file, line, thread);
   }
   // for AbortVMOnException flag
   NOT_PRODUCT(Exceptions::debug_check_abort(h_exception));
@@ -135,7 +138,7 @@
   // Create and throw exception
   Handle h_cause(thread, NULL);
   Handle h_exception = new_exception(thread, h_name, message, h_cause, h_loader, h_protection_domain);
-  _throw(thread, file, line, h_exception);
+  _throw(thread, file, line, h_exception, message);
 }
 
 // Throw an exception with a message and a cause
@@ -144,7 +147,7 @@
   if (special_exception(thread, file, line, h_name, message)) return;
   // Create and throw exception and init cause
   Handle h_exception = new_exception(thread, h_name, message, h_cause, h_loader, h_protection_domain);
-  _throw(thread, file, line, h_exception);
+  _throw(thread, file, line, h_exception, message);
 }
 
 // This version creates handles and calls the other version
--- a/src/share/vm/utilities/exceptions.hpp	Tue Oct 13 12:04:21 2009 -0700
+++ b/src/share/vm/utilities/exceptions.hpp	Tue Oct 13 16:29:31 2009 -0700
@@ -103,7 +103,7 @@
   } ExceptionMsgToUtf8Mode;
   // Throw exceptions: w/o message, w/ message & with formatted message.
   static void _throw_oop(Thread* thread, const char* file, int line, oop exception);
-  static void _throw(Thread* thread, const char* file, int line, Handle exception);
+  static void _throw(Thread* thread, const char* file, int line, Handle exception, const char* msg = NULL);
   static void _throw_msg(Thread* thread, const char* file, int line,
                          symbolHandle name, const char* message, Handle loader,
                          Handle protection_domain);