Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DataSource getDefaultParams Silent Failure

    A call to DataSource.getDefaultParams where no params exist
    silently fails.

    OS: Linux Ubuntu 2.6.38-12-generic
    Java: 1.6.0_22
    GWT: 2.2.0
    SmartGWT: 2.4, 2.5, and latest (2011-11-10)
    Browser: Firefox 7.0.1

    There are only two warnings in the developer console that don't
    appear to have anything to do with this issue.

    Code:
    10:51:44.530:WARN:Log:NOTE: Firebug is enabled. Firebug greatly slows the performance of applications that make heavy use of JavaScript. Isomorphic highly recommends Firebug for troubleshooting, but Firebug and other development tools should be disabled when assessing the real-world performance of SmartClient applications.
    10:51:44.737:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver]
    The test code I used is below. When there are no default params
    set, using the method getAttributeAsMap() succeeds but using
    getDefaultParams() silently fails.

    Code:
    package com.mycompany.tests.test_001.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.util.SC;  
    import com.smartgwt.client.widgets.IButton;  
    import com.smartgwt.client.widgets.layout.VLayout;
    import java.util.*;
    
    public class Test001 implements EntryPoint
    {
      private VLayout vlMain = new VLayout();
    
      public void onModuleLoad()
      {
        final Map<String,String> m1 = new HashMap<String,String>();
        m1.put("key1", "val1");
    
        IButton ibDefaultParamsGetAttributeAsMapNull = new IButton("DefaultParamsGetAttributeAsMapNull");  
        ibDefaultParamsGetAttributeAsMapNull.setWidth(300);
        ibDefaultParamsGetAttributeAsMapNull.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
        {  
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
          {       
            DataSource ds = new DataSource();
            Map m2 = ds.getAttributeAsMap("defaultParams");
            SC.say("DefaultParamsGetAttributeAsMapNull = " + m2);
          }       
        });
    
        IButton ibDefaultParamsGetAttributeAsMapSet = new IButton("DefaultParamsGetAttributeAsMapSet");  
        ibDefaultParamsGetAttributeAsMapSet.setWidth(300);
        ibDefaultParamsGetAttributeAsMapSet.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
        {  
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
          {       
            DataSource ds = new DataSource();
            ds.setDefaultParams(m1);
            Map m2 = ds.getAttributeAsMap("defaultParams");
            SC.say("DefaultParamsGetAttributeAsMapSet = " + m2);
          }       
        });
    
        IButton ibDefaultParamsGetDefaultParamsNull = new IButton("DefaultParamsGetDefaultParamsNull");
        ibDefaultParamsGetDefaultParamsNull.setWidth(300);
        ibDefaultParamsGetDefaultParamsNull.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
        {
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
          {
            DataSource ds = new DataSource();
            Map m2 = ds.getDefaultParams();
            SC.say("DefaultParamsGetDefaultParamsNull = " + m2);
          }
        });
    
        IButton ibDefaultParamsGetDefaultParamsSet = new IButton("DefaultParamsGetDefaultParamsSet");
        ibDefaultParamsGetDefaultParamsSet.setWidth(300);
        ibDefaultParamsGetDefaultParamsSet.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
        {
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
          {
            DataSource ds = new DataSource();
            ds.setDefaultParams(m1);
            Map m2 = ds.getDefaultParams();
            SC.say("DefaultParamsGetDefaultParamsSet = " + m2);
          }
        });
    
    
        vlMain.setWidth(300);
        vlMain.setHeight(500);
        vlMain.addMember(ibDefaultParamsGetAttributeAsMapNull);
        vlMain.addMember(ibDefaultParamsGetAttributeAsMapSet);
        vlMain.addMember(ibDefaultParamsGetDefaultParamsNull);
        vlMain.addMember(ibDefaultParamsGetDefaultParamsSet);
        vlMain.draw();
      }
    }

    #2
    We didn't see a silent failure, but there is a well-reported NullPointerException if you call getDefaultParams() when none have been set. We'll put this down as a bug, but as it's mostly an inconvenience it won't be addressed quickly.

    Comment

    Working...
    X