Revision: 9032
Author: [email protected]
Date: Tue Oct 12 10:52:56 2010
Log: 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: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9032

Modified:
 /trunk/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java

=======================================
--- /trunk/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java Thu Sep 30 09:09:15 2010 +++ /trunk/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java Tue Oct 12 10:52:56 2010
@@ -82,12 +82,15 @@
     return newSt;
   }

-  private Throwable deobfuscateThrowable(Throwable t, String strongName) {
-    if (t.getStackTrace() != null) {
- t.setStackTrace(deobfuscateStackTrace(t.getStackTrace(), strongName));
-    }
-    if (t.getCause() != null) {
-      t.initCause(deobfuscateThrowable(t.getCause(), 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 (old.getCause() != null) {
+      t.initCause(deobfuscateThrowable(old.getCause(), strongName));
     }
     return t;
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to