-
16 Jul 2008 6:15 AM #1
[FIXED] List.add(List) in BeanModelReader
[FIXED] List.add(List) in BeanModelReader
In last SVN build, lines 38-47 :
If you do that, the loader try to convert a list to a ModelData (ClassCastException). You should do instead (last line) or :Code:ListLoadResult result = (ListLoadResult) data; List beans = result.getData(); if (beans.size() > 0) { BeanModelFactory factory = BeanModelLookup.get().getFactory(beans.get(0).getClass()); if (factory == null) { throw new RuntimeException("No BeanModelFactory found for " + beans.get(0).getClass()); } List converted = factory.createModel(beans); beans.clear(); beans.add(converted);You can reproduce the issue with the explorer demo by replacing the ExplorerService.getCustomers return type from List<Customer> to ListLoadResult<Customer>Code:beans.addAll(converted);
-
16 Jul 2008 6:20 AM #2
By the way, I see you have :
In ExplorerServiceAsync :
In ExplorerService :Code:public void getCustomers(AsyncCallback<ListLoadResult<Customer>> callback);
Can you shortly explain me how does it work (how is List implicitly converted to ListLoadResult) ? Is it with deferred binding ? GWT serialization mechanism ?Code:public List<Customer> getCustomers();
-
16 Jul 2008 9:52 AM #3
Yes, that is a bug and has been fixed.Code:beans.add(converted);
The List is never converted to ListLoadResult by GWT. It looks like the GWT code does not enforce the type of data in the callback. From a GXT perspective, the reason this works is that the result is never assigned to ListLoadResult. The data proxy simply passes the data to the reader which checks the type of the data, which is List and then creates a new BaseListLoadResult instance.Can you shortly explain me how does it work (how is List implicitly
converted to ListLoadResult) ? Is it with deferred binding ? GWT
serialization mechanism ?
-
16 Jul 2008 11:50 PM #4


Reply With Quote