Fix deobfuscation of throwables with a cause. Previously, if the original throwable had a cause the t.setCause was failing
so now I create a new Throwable and return it rather than modify the existing one. The additional code for stack traces
is just to clear out the stack trace that was created when I did new Throwable(message) on the server.
Review by: fredsa@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9032 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java b/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java
index df05c97..40787fd 100644
--- a/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java
+++ b/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java
@@ -82,12 +82,15 @@
return newSt;
}
- private Throwable deobfuscateThrowable(Throwable t, String strongName) {
- if (t.getStackTrace() != null) {
- t.setStackTrace(deobfuscateStackTrace(t.getStackTrace(), strongName));
+ private Throwable deobfuscateThrowable(Throwable old, String strongName) {
+ Throwable t = new Throwable(old.getMessage());
+ if (old.getStackTrace() != null) {
+ t.setStackTrace(deobfuscateStackTrace(old.getStackTrace(), strongName));
+ } else {
+ t.setStackTrace(new StackTraceElement[0]);
}
- if (t.getCause() != null) {
- t.initCause(deobfuscateThrowable(t.getCause(), strongName));
+ if (old.getCause() != null) {
+ t.initCause(deobfuscateThrowable(old.getCause(), strongName));
}
return t;
}