Javascript exception calling willFetchData()

I’m trying to force a new fetch when using fetchData() on a ListGrid. The request may be for the same criteria as the last fetch, but I want the latest from the server. I’ve added this code to invalidateCache() prior to calling fetchData(). The call to getPendingPoGrid() simply returns the ListGrid.

if (!getPendingPoGrid().willFetchData(selectionCriteria)) 
	getPendingPoGrid().invalidateCache(); // Force a new fetch each time

I get this error the first time I call that code. Second and subsequent calls work fine.

13:24:14.879 [ERROR] [ipgui] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (String): Invoking an instance method on a null instance
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.google.gwt.dev.shell.ModuleSpace.createJavaScriptException(ModuleSpace.java:65)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:60)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.smartgwt.client.widgets.grid.ListGrid.willFetchData(ListGrid.java)
    at com.islandpacific.gui.client.POInquiry.fetchPendingPoGridData(POInquiry.java:418)
    at com.islandpacific.gui.client.POInquiry.fetchData(POInquiry.java:444)
    at com.islandpacific.gui.client.POInquiry$4.onChanged(POInquiry.java:186)
    at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:95)
    at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:1)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:197)
    at sun.reflect.GeneratedMethodAccessor429.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
    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:188)
    at sun.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Thread.java:637)

No idea what that error message is intended to mean. Can you get something more coherent running in compiled mode?

When I run the compiled version I don’t see any errors in the dev console when I trigger the fetch. I just see the “contacting server” message and then no results. If I trigger the fetch again it works.

This may be related to the problem. I’m using a SelectItem to trigger the fetch when the selection is changed. When the Canvas is first drawn I see a warning in the console.

08:25:02.886 [ERROR] [ipgui] 08:25:02.885:MDN4[E]:WARN:PickListMenu:isc_PickListMenu_0:fields and completeFields are null and there is no DataSource
com.smartgwt.client.core.JsObject$SGWT_WARN: 08:25:02.885:MDN4[E]:WARN:PickListMenu:isc_PickListMenu_0:fields and completeFields are null and there is no DataSource
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Thread.java:637)

Here is the code that sets up the form which has only the SelectItem on it.

DynamicForm form = new DynamicForm();
form.setDataSource(DataSource.get("IPFGCTL"));
fileGroupSelect = new SelectItem("FFGP");
fileGroupSelect.setOptionDataSource(DataSource.get("IPFGCTL"));
fileGroupSelect.setOptionCriteria(new Criteria("FAPP","PO"));
fileGroupSelect.setTextAlign(Alignment.RIGHT);
fileGroupSelect.setAllowEmptyValue(true);
fileGroupSelect.setSortField("FFGP");
fileGroupSelect.setValueField("FFGP");
fileGroupSelect.setDisplayField("FFGP");
fileGroupSelect.setWidth(50);
fileGroupSelect.addChangedHandler(new ChangedHandler() {
	@Override
	public void onChanged(ChangedEvent event) {
		fetchData(theCriteria);				
	}
});
form.setFields(fileGroupSelect);

I’m confused by the warning since, as you can see from the code, I am setting the datasource as well as ValueField and DisplayField.

Just downloaded the latest nightly (July 5) build and this is now fixed.