Can anyone take a look at this and let me know if this flow seems sane? I'm seeing an error:
Caused by: java.lang.AssertionError: Unfrozen bean with null RequestContext
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.checkStreamsNotCrossed(AbstractRequestContext.java:841)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.editProxy(AbstractRequestContext.java:425)
doing this.
I have a CompositeEditor that needs to be able to make a server call to get a "template" object that it then spawns a new editor for.
I have an outer object OuterObject that contains a collection of InnerObject.
1. Instantiate OuterObjectEditor with a RequestFactoryEditorDriver and a context.
This calls the setValue and populates the InnerObjectCompositeEditor with the current values, which are displayed in a table.
2. User clicks a button to add a new InnerObject, which creates a new context, makes a server call to create the new object, and calls back with the new InnerObject.
3. Instantiate a new RequestFactoryEditorDriver and InnerObjectEditor for the InnerObject, call driver.edit(OuterObjectEditor's context, innerObject) and attach the editor to the chain.
4. The user edits the new object and clicks save.
5. Flush the InnerObjectEditor using the inner driver , and call chain.getValue() to read the new object's values and display it in the table.
6. The user clicks save and everything saves properly.
7. As a result of the save, the saved OuterObject (with inner objects) is reloaded and passed back in to the outerObjectEditActivity.
8. The activity creates a new context, and calls driver.edit(returned OuterObject, new context)
This last step throws an exception :
Caused by: java.lang.AssertionError: Unfrozen bean with null RequestContext
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.checkStreamsNotCrossed(AbstractRequestContext.java:841)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.editProxy(AbstractRequestContext.java:425)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$3.visitCollectionProperty(AbstractRequestContext.java:896)
at com.mypackage....OuterObjectProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory.traverseProperties(OuterObjectProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory.java:268)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.cloneBeanAndCollections(AbstractRequestContext.java:866)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.editProxy(AbstractRequestContext.java:441)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.edit(AbstractRequestContext.java:418)
at com.google.web.bindery.requestfactory.gwt.client.impl.RequestFactoryEditorDelegate.ensureMutable(RequestFactoryEditorDelegate.java:137)
at com.google.gwt.editor.client.impl.BaseEditorDriver.doEdit(BaseEditorDriver.java:89)
at com.google.web.bindery.requestfactory.gwt.client.impl.AbstractRequestFactoryEditorDriver.edit(AbstractRequestFactoryEditorDriver.java:177)
at com.mypackage....OuterObjectEditActivity.edit(OuterObjectEditActivity.java:196)
...
My best guess is that there is something stale hanging around in the editor, since my setValue call on my innerObjectCompositeEditor has not yet been called. When I look at the collection in the cloneBeanAndCollections method in the stack trace in a debugger, it only has the old items, not the newly created item. Is there some way to tell the driver to discard anything it has in the editor, and start over with the new object?
Thanks,
Eric