How to debug Javascript exceptions?

Hello,
I’m getting a Javascript exception in Firebug console, which offers some links from the stacktrace (I guess), but clicking on them just shows the corresponding lines of code in the js (I compiled Vaadin in detailed mode).

Generally speaking, how can I debug them?

In this particular case the exception is


JavaScriptException: (TypeError): this$static.com_vaadin_terminal_gwt_client_ui_VScrollTable_scrollBody is null

I’m using Vaadin 6.7.4

I’m having the same JavaScriptException with Vaadin 6.7.4 and would also like to debug it.

Chrome JavaScript console reports stack trace which doesn’t seem to provide much additional information:

JavaScriptException: (TypeError): Cannot read property 'com_vaadin_terminal_gwt_client_ui_VScrollTable$VScrollTableBody$VScrollTableRow_index' of null
 com_vaadin_terminal_gwt_client_VDebugConsole_$error__Lcom_vaadin_terminal_gwt_client_VDebugConsole_2Ljava_lang_String_2V
 com_vaadin_terminal_gwt_client_VDebugConsole_$error__Lcom_vaadin_terminal_gwt_client_VDebugConsole_2Ljava_lang_Throwable_2V
 com_vaadin_terminal_gwt_client_VDebugConsole_error__Ljava_lang_Throwable_2V
 com_vaadin_terminal_gwt_client_ApplicationConnection$8_$execute__Lcom_vaadin_terminal_gwt_client_ApplicationConnection$8_2V
 com_vaadin_terminal_gwt_client_ApplicationConnection_$handleUIDLMessage__Lcom_vaadin_terminal_gwt_client_ApplicationConnection_2Ljava_util_Date_2Ljava_lang_String_2Lcom_vaadin_terminal_gwt_client_ValueMap_2V
 com_vaadin_terminal_gwt_client_ApplicationConnection$2_onResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V
 com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V
 com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V
 (anonymous function) 
 com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2
 com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2
 (anonymous function)

OK. Debugging seems to be quite easy using GWT Development mode.

Fully detailed stack trace from original client-side exception is:

java.lang.NullPointerException: null
 	at com.vaadin.terminal.gwt.client.ui.VScrollTable$SelectionRange.<init>(VScrollTable.java:235)
 	at com.vaadin.terminal.gwt.client.ui.VScrollTable$SelectionRange.split(VScrollTable.java:274)
 	at com.vaadin.terminal.gwt.client.ui.VScrollTable.removeRowFromUnsentSelectionRanges(VScrollTable.java:6716)
 	at com.vaadin.terminal.gwt.client.ui.VScrollTable.selectSelectedRows(VScrollTable.java:1112)
 	at com.vaadin.terminal.gwt.client.ui.VScrollTable.updateFromUIDL(VScrollTable.java:907)
 	at com.vaadin.terminal.gwt.client.ApplicationConnection$8.execute(ApplicationConnection.java:951)
 	at com.vaadin.terminal.gwt.client.ApplicationConfiguration.runWhenWidgetsLoaded(ApplicationConfiguration.java:359)
 	at com.vaadin.terminal.gwt.client.ApplicationConnection.handleUIDLMessage(ApplicationConnection.java:1082)
 	at com.vaadin.terminal.gwt.client.ApplicationConnection.handleReceivedJSONMessage(ApplicationConnection.java:860)
 	at com.vaadin.terminal.gwt.client.ApplicationConnection.access$6(ApplicationConnection.java:858)
 	at com.vaadin.terminal.gwt.client.ApplicationConnection$2.onResponseReceived(ApplicationConnection.java:545)
 	at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
 	at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
 	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 	at java.lang.reflect.Method.invoke(Method.java:601)
 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
 	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 	at java.lang.reflect.Method.invoke(Method.java:601)
 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
 	at java.lang.Thread.run(Thread.java:722)

Now just to debug why it occures and report a Vaadin bug from it.

Created ticket [url=http://dev.vaadin.com/ticket/8264]

8264

[/url].

Thanks for the suggestion, I managed to get a stacktrace too.