簡體   English   中英

在GWT 2.7超級開發模式下調試,是否缺少stackTrace?

[英]Debugging in GWT 2.7 Super Dev Mode, stackTrace is missing?

我剛剛從GWT 2.5.1遷移到2.7並且第一次使用SuperDev模式。 我在Chrome開發工具中啟用了“JavaScript源地圖”。 在Chrome控制台中,異常如下所示:

com.google.gwt.event.shared.UmbrellaException: Exception caught: For input string: "a"
  at fillInStackTrace_0_g$
  at Throwable_3_g$
  at Exception_3_g$
  at RuntimeException_3_g$
  at UmbrellaException_3_g$
  at UmbrellaException_5_g$
  at fireEvent_1_g$
  at fireEvent_3_g$
  at fireNativeEvent_1_g$
  at onBrowserEvent_2_g$
  at dispatchEventImpl_0_g$
  at dispatchEvent_4_g$
  at dispatchEvent_6_g$
  at apply_0_g$
  at entry0_0_g$
  at <anonymous>
Caused by: java.lang.NumberFormatException: For input string: "a"
  at fillInStackTrace_0_g$
  at Throwable_2_g$
  at Exception_2_g$
  at RuntimeException_2_g$
  at IllegalArgumentException_2_g$
  at NumberFormatException_2_g$
  at forInputString_0_g$
  at __parseAndValidateDouble_0_g$
  at parseDouble_0_g$
  at Double_2_g$
  at valueOf_68_g$
  at onClick_109_g$
  at dispatch_6_g$
  at dispatch_7_g$
  at dispatch_1_g$
  at dispatchEvent_2_g$
  at doFire_0_g$
  at fireEvent_2_g$
  at fireEvent_1_g$
  at fireEvent_3_g$
  at fireNativeEvent_1_g$
  at onBrowserEvent_2_g$
  at dispatchEventImpl_0_g$
  at dispatchEvent_4_g$
  at dispatchEvent_6_g$
  at apply_0_g$
  at entry0_0_g$
  at <anonymous>

OnModuleLoad我是cacthing例外:

GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        @Override
        public void onUncaughtException(Throwable e) {
            GWT.log(e);
        }
    });

我怎樣才能獲得stackTrace? 我試過這樣的事情https://stackoverflow.com/a/24334132/1660637但無法正常工作。

您是否嘗試將這些添加到gwt.xml文件中?

<set-property name="compiler.stackMode" value="emulated"/>
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>

SuperDevMode,堆棧跟蹤和GWT.log的使用存在一個未解決的問題 GWT 2.8似乎也有所改進

據我所知,如果你使用普通的java.util.logging而不是GWT.log你應該在SDM中獲得堆棧跟蹤。

從onModuleLoad調用以下方法。 請注意,必須使用java.util.Logging才能生效。 GWT.log無法正常處理異常。

/ ** *設置一個未捕獲的異常處理程序,為SuperDevMode解包異常*(UmbrellaException)。 * / private void setUncaughtExceptionHandler(){GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler(){@ Override public void onUncaughtException(Throwable e){Throwable unwrapped = unwrap(e); BootBox.error(I18NMessages.getMessage(3774)+“\\ n \\ n“+ unwrapped”; LOGGER.log(Level.EXCEPTION,“onUncaughtException”+ e.getMessage(),unwrapped);}

     public Throwable unwrap(Throwable e)
     {
        if (e instanceof UmbrellaException)
        {
           UmbrellaException ue = (UmbrellaException) e;
           if (ue.getCauses().size() == 1)
           {
              return unwrap(ue.getCauses().iterator().next());
           }
        }
        return e;
     }
  });

}

LOGGER以下列方式創建

public static final Logger LOGGER = Logger.getLogger("Something");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM