changeset 4241:366fcac7ee01

Merge
author lana
date Wed, 18 May 2011 17:18:52 -0700
parents 5b38ed5f5eb4 65dd04c9ee64
children efbf75c24b0f
files
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/Throwable.java	Mon May 16 18:19:34 2011 -0700
+++ b/src/share/classes/java/lang/Throwable.java	Wed May 18 17:18:52 2011 -0700
@@ -777,7 +777,8 @@
      * @see     java.lang.Throwable#printStackTrace()
      */
     public synchronized Throwable fillInStackTrace() {
-        if (stackTrace != null) {
+        if (stackTrace != null ||
+            backtrace != null /* Out of protocol state */ ) {
             fillInStackTrace(0);
             stackTrace = UNASSIGNED_STACK;
         }
@@ -817,7 +818,8 @@
     private synchronized StackTraceElement[] getOurStackTrace() {
         // Initialize stack trace field with information from
         // backtrace if this is the first call to this method
-        if (stackTrace == UNASSIGNED_STACK) {
+        if (stackTrace == UNASSIGNED_STACK ||
+            (stackTrace == null && backtrace != null) /* Out of protocol state */) {
             int depth = getStackTraceDepth();
             stackTrace = new StackTraceElement[depth];
             for (int i=0; i < depth; i++)
@@ -865,7 +867,8 @@
         }
 
         synchronized (this) {
-            if (this.stackTrace == null) // Immutable stack
+            if (this.stackTrace == null && // Immutable stack
+                backtrace == null) // Test for out of protocol state
                 return;
             this.stackTrace = defensiveCopy;
         }