Revision: 9342
Author: [email protected]
Date: Thu Dec  2 09:54:42 2010
Log: StackTraceDeobfuscator now extracts source file and (method declaration) line number information from the provided symbol map file, when this information is not provided by optionally enabled stack trace emulation.

Fixes issues: 5682

Review at http://gwt-code-reviews.appspot.com/1175801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9342

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

=======================================
--- /trunk/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java Tue Nov 16 10:13:16 2010 +++ /trunk/user/src/com/google/gwt/logging/server/StackTraceDeobfuscator.java Thu Dec 2 09:54:42 2010
@@ -73,8 +73,22 @@
       if (parts.length == 5) {
         String[] ref = parse(
             parts[0].substring(0, parts[0].lastIndexOf(')') + 1));
-        return new StackTraceElement(
-            ref[0], ref[1], ste.getFileName(), ste.getLineNumber());
+
+        // parts[3] contains the source file URI or "Unknown"
+        String filename = "Unknown".equals(parts[3]) ? null
+            : parts[3].substring(parts[3].lastIndexOf('/') + 1);
+
+        int lineNumber = ste.getLineNumber();
+        /*
+ * When lineNumber is zero, either because compiler.stackMode is not + * emulated or compiler.emulatedStack.recordLineNumbers is false, use
+         * the method declaration line number from the symbol map.
+         */
+        if (lineNumber == 0) {
+          lineNumber = Integer.parseInt(parts[4]);
+        }
+
+        return new StackTraceElement(ref[0], ref[1], filename, lineNumber);
       }
     }
     // If anything goes wrong, just return the unobfuscated element

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

Reply via email to