You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    180
    Vote Rating
    1
    dardison is on a distinguished road

      0  

    Default NumberPropertyEditor render doesn't support null values

    Required Information


    Version(s) of Ext GWT
    Ext GWT 3.0.1


    Browser versions and OS
    (and desktop environment, if applicable)
    • Firefox 11, Windows 7 64bits


    Virtual Machine
    «Yes/No»


    Description
    If the render method of the NumberPropertyEditor receives a null value you will end up with a null pointer exception


    Run mode
    Both


    Steps to reproduce the problem
    1. Defines a Column in a Grid which is Double and set it to null


    Expected Result
    It should return space or "" I think


    Actual result


    Caused by: java.lang.NullPointerException: null
    at com.sencha.gxt.widget.core.client.form.NumberPropertyEditor.render(NumberPropertyEditor.java:294)
    at com.sencha.gxt.widget.core.client.form.NumberPropertyEditor.render(NumberPropertyEditor.java:1)
    at com.sencha.gxt.cell.core.client.PropertyDisplayCell.render(PropertyDisplayCell.java:24)
    at com.sencha.gxt.widget.core.client.grid.GridView.getRenderedValue(GridView.java:1674)
    at com.sencha.gxt.widget.core.client.grid.GridView.doRender(GridView.java:1381)
    at com.sencha.gxt.widget.core.client.grid.GridView.renderRows(GridView.java:2562)
    at com.sencha.gxt.widget.core.client.grid.GridView.insertRows(GridView.java:2078)
    at com.sencha.gxt.widget.core.client.grid.GridView.onAdd(GridView.java:2169)
    at com.sencha.gxt.widget.core.client.grid.GridView$10.onAdd(GridView.java:1974)
    at com.sencha.gxt.data.shared.event.StoreAddEvent.dispatch(StoreAddEvent.java:118)
    at com.sencha.gxt.data.shared.event.StoreAddEvent.dispatch(StoreAddEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.sencha.gxt.data.shared.Store.fireEvent(Store.java:602)
    at com.sencha.gxt.data.shared.ListStore.add(ListStore.java:85)
    at com.sencha.gxt.data.shared.ListStore.add(ListStore.java:95)
    at com.arballon.web.framework.client.transaction.presenter.ListTransactionPresenterImpl.addNew(ListTransactionPresenterImpl.java:128)
    at com.arballon.web.framework.client.transaction.view.ListTransactionViewImpl$1.onAddRow(ListTransactionViewImpl.java:59)
    at com.arballon.web.framework.client.event.grid.AddRowEvent.dispatch(AddRowEvent.java:42)
    at com.arballon.web.framework.client.event.grid.AddRowEvent.dispatch(AddRowEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
    at com.sencha.gxt.widget.core.client.Component.fireEvent(Component.java:285)
    at com.arballon.web.framework.client.ui.widget.grid.BaseEditorGridPanel.onAdd(BaseEditorGridPanel.java:94)
    at com.arballon.web.framework.client.ui.widget.grid.BaseEditorGridPanel$1.onSelect(BaseEditorGridPanel.java:71)
    at com.sencha.gxt.widget.core.client.event.SelectEvent.dispatch(SelectEvent.java:58)
    at com.sencha.gxt.widget.core.client.event.SelectEvent.dispatch(SelectEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.sencha.gxt.cell.core.client.AbstractEventCell.fireEvent(AbstractEventCell.java:82)
    at com.sencha.gxt.cell.core.client.ButtonCell.onClick(ButtonCell.java:421)
    at com.sencha.gxt.cell.core.client.ButtonCell.onBrowserEvent(ButtonCell.java:282)
    at com.sencha.gxt.widget.core.client.cell.CellComponent.onBrowserEvent(CellComponent.java:214)
    at com.sencha.gxt.widget.core.client.button.CellButtonBase.onBrowserEvent(CellButtonBase.java:156)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
    at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Thread.java:662)



    Possible fix
    You could correct the method like this I think:

    Code:
      @Override
      public String render(Number value) {
        if (format != null) {
          if(value==null){
             return "";
          else {
             return format.format(value.doubleValue());
          }
        }
        return value.toString();
      }

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,736
    Vote Rating
    92
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default

    Thanks, as discussed in IRC this is filed with the team as EXTGWT-2057. At first glance, my preferred method would be to bring PropertyEditorCell in line with how NumberInputCell works (which lets superclass TriggerFieldCell handle it), which does a null check before asking the property editor.

  3. #3
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    180
    Vote Rating
    1
    dardison is on a distinguished road

      0  

    Default

    For now I patched my code with:

    In PropertyDisplayCell :

    Code:
      public void render(Cell.Context context, C value, SafeHtmlBuilder sb) {
    	  if(value!=null)
    		  sb.appendEscaped(propertyEditor.render(value));
      }
    That resolves the issue.
    Regards.
    Daniel

Thread Participants: 1