Found in GWT Release (e.g. 2.4.0, 2.5.0 RC): 2.4.0
Encountered on OS / Browser (e.g. WinXP, IE8-9, FF7): MacOS X, Chrome
Detailed description (please be as specific as possible):
An NPE is thrown in the app when trying to initialize a CellTree with a TreeViewModel
that has a null DataProvider instance for the 'base' (when tree is empty or null) case
for getNodeInfo(T value) method. This should be handled gracefully since it is always
possible to initialize the DataProvider later in the application lifecycle.
Stacktrace:
java.lang.NullPointerException: null
at com.google.gwt.view.client.TreeViewModel$DefaultNodeInfo.setDataDisplay(TreeViewModel.java:112)
at com.google.gwt.user.cellview.client.CellTreeNodeView.onOpen(CellTreeNodeView.java:1087)
at com.google.gwt.user.cellview.client.CellTreeNodeView.setOpen(CellTreeNodeView.java:903)
at com.google.gwt.user.cellview.client.CellTree.<init>(CellTree.java:603)
at com.google.gwt.user.cellview.client.CellTree.<init>(CellTree.java:553)
Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):
See description.
class X implements TreeViewModel {
@Override
public <T> NodeInfo<?> getNodeInfo(T value) {
if (value == null)
return new DefaultNodeInfo<Y>(null, new TextCell());
}
}
class Z implements EntryPoint {
public void onModuleLoad() {
final CellTree cellTree = new CellTree(new X(), null);
}
}
Workaround if you have one:
precondition to getNodeInfo() : DataProvider shouldn't be null
Links to relevant GWT Developer Forum posts:
Link to patch posted at http://gwt-code-reviews.appspot.com:
Originally reported on Google Code with ID 7483
Reported by
obvyst
on 2012-07-04 09:57:20