12302 asynchronously-thrown Throwables should have blocking thread's stack trace appended for debuggability
--- a/usr/src/java/util/org/opensolaris/os/vp/util/misc/ThrowableUtil.java Tue Oct 27 19:51:12 2009 -0400
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/misc/ThrowableUtil.java Wed Oct 28 17:23:00 2009 -0400
@@ -48,4 +48,27 @@
t = cause;
}
}
+
+ /**
+ * Appends the stack trace of the current thread to the stack trace in
+ * given {@code Throwable}.
+ */
+ public static void appendStackTrace(Throwable t) {
+ StackTraceElement[] throwableStack = t.getStackTrace();
+ StackTraceElement[] threadStack =
+ Thread.currentThread().getStackTrace();
+
+ // Strip out the call to Thread.getStackTrace and this method
+ int offset = 2;
+
+ StackTraceElement[] stack = new StackTraceElement[
+ throwableStack.length + threadStack.length - offset];
+
+ System.arraycopy(throwableStack, 0, stack, 0, throwableStack.length);
+
+ System.arraycopy(threadStack, offset, stack, throwableStack.length,
+ threadStack.length - offset);
+
+ t.setStackTrace(stack);
+ }
}
--- a/usr/src/java/util/org/opensolaris/os/vp/util/swing/GUIUtil.java Tue Oct 27 19:51:12 2009 -0400
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/swing/GUIUtil.java Wed Oct 28 17:23:00 2009 -0400
@@ -578,6 +578,7 @@
break;
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
+ ThrowableUtil.appendStackTrace(cause);
if (cause instanceof RuntimeException) {
throw (RuntimeException)cause;
--- a/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Tue Oct 27 19:51:12 2009 -0400
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Wed Oct 28 17:23:00 2009 -0400
@@ -167,6 +167,8 @@
Throwable t = throwable[0];
if (t != null) {
+ ThrowableUtil.appendStackTrace(t);
+
if (t instanceof NavigationAbortedException)
throw (NavigationAbortedException)t;