Exception thrown by FlexTable

39 views
Skip to first unread message

David Illescas

unread,
Nov 2, 2011, 12:39:39 AM11/2/11
to Google Web Toolkit
Hello. I am fairly new to GWT but really enjoying its use. I have the
following dilemma.

I build a FlexTable using and define the contents of its first row as
follows:

fts.setText(0,0,"Passenger ID");
fts.setText(0, 1, "Source Floor");
fts.setText(0,2, "Destination Floor");

update(index);

The update index is responsible for finishing the initialization.
Inside it has a for loop of the following form:

for(int i = 1; i <= data.passenger_destinations.size(); ++i){
fts.setText(i,0,"Passenger " +
i);
<------------
fts.setText(i,1,
Integer.toString(data.passenger_origins.get(i-1)+1));
fts.getCellFormatter().setHorizontalAlignment(i,
1,HasHorizontalAlignment.ALIGN_CENTER);
fts.setText(i,2,
Integer.toString(data.passenger_destinations.get(i-1)+1));
fts.getCellFormatter().setHorizontalAlignment(i,
2,HasHorizontalAlignment.ALIGN_CENTER);
}

That is about all the code dealing with the FlexTable. However, when
the code is run, at some point during its execution I get the
following exception:

21:22:34.733 [ERROR] [visualizer] Uncaught exception escaped
com.google.gwt.dev.shell.HostedModeException: Something other than an
int was returned from JSNI method
'@com.google.gwt.user.client.ui.HTMLTable::getDOMRowCount(Lcom/google/
gwt/user/client/Element;)': JS value of type null, expected int

That seems clear enough, but when I look at the stack trace, I see
that it happens on the line with the arrow above, and is thrown by the
FlexTable when it tries to get the row count. I am wondering if anyone
knows what is going on, or how to proceed in investigating the matter.
The full stack trace follows.


at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:
266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:
247)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:
75)
at
com.google.gwt.user.client.ui.HTMLTable.getDOMRowCount(HTMLTable.java)
at
com.google.gwt.user.client.ui.HTMLTable.getDOMRowCount(HTMLTable.java:
1250)
at
com.google.gwt.user.client.ui.FlexTable.getRowCount(FlexTable.java:
151)
at
com.google.gwt.user.client.ui.FlexTable.prepareRow(FlexTable.java:246)
at
com.google.gwt.user.client.ui.FlexTable.prepareCell(FlexTable.java:
218)
at com.google.gwt.user.client.ui.HTMLTable.setText(HTMLTable.java:
1117)
at com.eece419.visualizer.client.ElevatorDataPanel
$ElevatorWidgets.update(ElevatorDataPanel.java:286)
<-----------------the call to the for loop
at com.eece419.visualizer.client.ElevatorDataPanel
$ElevatorWidgets.access$0(ElevatorDataPanel.java:248)
<------------------ The call to update()
at com.eece419.visualizer.client.ElevatorDataPanel
$Floortabs.update(ElevatorDataPanel.java:180)
at
com.eece419.visualizer.client.ElevatorDataPanel.update(ElevatorDataPanel.java:
52)
at com.eece419.visualizer.client.Visualizer
$2.onSuccess(Visualizer.java:94)
at com.eece419.visualizer.client.Visualizer
$2.onSuccess(Visualizer.java:1)
at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
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.GeneratedMethodAccessor36.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
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:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
337)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
218)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
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:213)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
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:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
292)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
546)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:679)

Erik

unread,
Nov 3, 2011, 4:56:54 AM11/3/11
to Google Web Toolkit
Is it possible that the List 'data' contains a null value?
and that data.passenger_origins.get(i-1) = null?

This can explain the message 'JS value of type null, expected int'

greets

Thomas Broyer

unread,
Nov 3, 2011, 5:16:00 AM11/3/11
to google-we...@googlegroups.com
Could be related to http://code.google.com/p/google-web-toolkit/issues/detail?id=5778
Which browser are you using? Do you reproduce it in a different browser? Do you reproduce it in prod/web mode?
Reply all
Reply to author
Forward
0 new messages