Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Stack Trace with SuperDevMode is obfusated

Tags:

java

gwt

I have this code to handle uncaught exceptions with GWT:

    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        @Override
        public void onUncaughtException(Throwable throwable) {
            // Iterate over the trace and then print with $wnd.console.log
            printStackTrace(throwable.getStackTrace());
        }
    });

However the log printed in the Browser console looks like this:

"Unknown.Ol(Unknown Source)
Unknown.Nl(Unknown Source)
Unknown.Vl(Unknown Source)
Unknown.Hu(Unknown Source)
Unknown.Ku(Unknown Source)
Unknown.ju(Unknown Source)
Unknown.h6(Unknown Source)
Unknown.As(Unknown Source)
Unknown.j6(Unknown Source)
Unknown.u6(Unknown Source)
Unknown.L3(Unknown Source)
Unknown.k5(Unknown Source)
Unknown.hn(Unknown Source)
Unknown.mn(Unknown Source)
Unknown.ln/<(Unknown Source)
Unknown.anonymous(Unknown Source)

How can I make this show the actual stack trace like the old GWT style?

like image 568
quarks Avatar asked Aug 01 '26 05:08

quarks


1 Answers

This worked for me, keep in mind it's not perfect but it will give you the file and line numbers in your stack trace. Yes this works with gwt 2.7 and super dev mode. You need to add this to your *.gwt.xml file. You may want to turn this off for production because it adds quite a bit of code bloat but makes debugging much much simpler.

<set-property name="compiler.stackMode" value="emulated" />
<set-configuration-property name="compiler.emulatedStack.recordFileNames"
value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers"
value="true" />
like image 198
Chris Hinshaw Avatar answered Aug 03 '26 19:08

Chris Hinshaw