View Full Version : [FIXED] BaseModel : NullPointerException

29 Apr 2008, 2:42 AM

I get a NullPointerException, when trying to load my module in hosted mode :

[ERROR] Unable to load module entry point class gui.client.MyBug (see associated exception for details)
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.data.BaseModel.notify(BaseModel.java:81)
at com.extjs.gxt.ui.client.data.BaseTreeModel.notify(BaseTreeModel.java:126)
at com.extjs.gxt.ui.client.data.BaseModel.notifyPropertyChanged(BaseModel.java:121)
at com.extjs.gxt.ui.client.data.BaseModel.set(BaseModel.java:87)
at com.extjs.gxt.ui.client.data.BaseModelData.<init>(BaseModelData.java:37)
at com.extjs.gxt.ui.client.data.BaseModel.<init>(BaseModel.java:68)
at com.extjs.gxt.ui.client.data.BaseTreeModel.<init>(BaseTreeModel.java:42)
at gui.client.MyBug.onModuleLoad(MyBug.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Here is my module code :

public class MyBug implements EntryPoint {
private Tree tree;
private TreeViewer folders;

* This is the entry point method.
public void onModuleLoad() {
tree = new Tree();

folders = new TreeViewer(tree);
folders.setLabelProvider(new ModelLabelProvider());
folders.setContentProvider(new ModelTreeContentProvider() {
public boolean hasChildren(Object element) {
return false;

HashMap<String, Object> maMap = new HashMap<String, Object>();
maMap.put("name", "My folder 1");
final BaseTreeModel model = new BaseTreeModel();
BaseTreeModel ligne1 = new BaseTreeModel(maMap);
I'm using gwt-windows-0.0.2415 (1.5M2), jdk 6 update 10 and gxt-1.0-beta1.

29 Apr 2008, 3:20 AM
It tells you the line number in onModuleLoad - the stack trace contains

As I don't have your full source I can only guess it might be due to the fact you are you adding a BaseTreeModel to a BaseTreeModel?

29 Apr 2008, 3:40 AM
Sorry. I ve modified my post and put line 38 in bold. I don't think it's due to the fact I add a BaseTreeModel to a BaseTreeModel. If you replace the line 38 by :

BaseTreeModel ligne1 = new BaseTreeModel(); //empty constructor
ligne1.set("name", "My folder 1");

then it works.

29 Apr 2008, 11:28 PM
There is a bug in BaseModel using a map in the constructor. Fix is in SVN.