src/share/classes/java/lang/Throwable.java
Print this page
*** 956,977 ****
// Ensure that the stackTrace field is initialized to a
// non-null value, if appropriate. As of JDK 7, a null stack
// trace field is a valid value indicating the stack trace
// should not be set.
getOurStackTrace();
- ObjectOutputStream.PutField fields = s.putFields();
! fields.put("detailMessage", detailMessage);
! fields.put("cause", cause);
! // Serialize a null stacktrace using the stack trace sentinel.
if (stackTrace == null)
! fields.put("stackTrace", SentinelHolder.STACK_TRACE_SENTINEL);
! else
! fields.put("stackTrace", stackTrace);
! fields.put("suppressedExceptions", suppressedExceptions);
!
! s.writeFields();
}
/**
* Appends the specified exception to the exceptions that were
* suppressed in order to deliver this exception. This method is
--- 956,974 ----
// Ensure that the stackTrace field is initialized to a
// non-null value, if appropriate. As of JDK 7, a null stack
// trace field is a valid value indicating the stack trace
// should not be set.
getOurStackTrace();
! StackTraceElement[] oldStackTrace = stackTrace;
! try {
if (stackTrace == null)
! stackTrace = SentinelHolder.STACK_TRACE_SENTINEL;
! s.defaultWriteObject();
! } finally {
! stackTrace = oldStackTrace;
! }
}
/**
* Appends the specified exception to the exceptions that were
* suppressed in order to deliver this exception. This method is