1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default [FIXED] BaseModel : NullPointerException

    [FIXED] BaseModel : NullPointerException


    Hi,

    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 :
    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() {
                @Override
                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);
            model.add(ligne1);
            folders.setInput(model);
            RootPanel.get().add(tree);
        }
    }
    I'm using gwt-windows-0.0.2415 (1.5M2), jdk 6 update 10 and gxt-1.0-beta1.

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    It tells you the line number in onModuleLoad - the stack trace contains
    gui.client.MyBug.onModuleLoad(MyBug.java:38)

    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?

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default


    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 :
    Code:
    BaseTreeModel ligne1 = new BaseTreeModel(); //empty constructor
    ligne1.set("name", "My folder 1");
    then it works.

  4. #4
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    There is a bug in BaseModel using a map in the constructor. Fix is in SVN.

Thread Participants: 2