Announcement

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

    NullPointer in DSResponse.getDataAsRecordList()

    Be sure your post includes:

    1. Isomorphic SmartClient/SmartGWT Framework (v8.3p_2013-06-11/Enterprise Deployment 2013-06-11)

    2. IE 9

    3. client-side

    4.

    5.
    Code:
    12:50:00.317 [ERROR] [compass] Uncaught exception escaped
    
    java.lang.NullPointerException: null
        at com.smartgwt.client.util.IDManager.validateID(IDManager.java:29)
        at com.smartgwt.client.util.IDManager.registerID(IDManager.java:78)
        at com.smartgwt.client.core.BaseClass.registerID(BaseClass.java:63)
        at com.smartgwt.client.core.BaseClass.internalSetID(BaseClass.java:72)
        at com.smartgwt.client.core.BaseClass.<init>(BaseClass.java:47)
        at com.smartgwt.client.data.RecordList.<init>(RecordList.java:68)
        at com.smartgwt.client.data.DSResponse.getDataAsRecordList(DSResponse.java:423)
        at com.x.MyPage$1.execute(MyPage.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        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.GeneratedMethodAccessor41.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)

    6. The application is simply trying to read the response data as a RecordList and store it in a member variable:
    Code:
    DataSource.get("statusDS").fetchData(null, new DSCallback() {
    	@Override
    	public void execute(DSResponse response, Object rawData, DSRequest request) {
    		MyPage.statusList= response.getDataAsRecordList();
    	}
    });
    Part of the call chain for "getDataAsRecordList()" includes an assert statement in IDManager.validateID(), trying to validate that the ID attribute of the response "data" element is a valid identifier. Unfortunately, the "data" attribute of the DSResponse doesn't have an "ID" attribute, and the assert statement doesn't check for null.
    Code:
        private static void validateID(String id, boolean skipUniqueJSIdentifierCheck) {
            assert id.matches("[a-zA-Z_$][0-9a-zA-Z_$]*") : "Invalid ID : " + id + 
                ". Valid ID's must meet the following pattern [a-zA-Z_$][0-9a-zA-Z_$]*";
            ...
        }
    The error only shows up in Dev Mode, as "assert" statements are compiled out in production mode.

    As an aside, I'm also having trouble showing the Dev Console. SC.showConsole() opens a new browser window, but the contents are an error message for "400-Bad Request". This may not be caused by the new build; this may be a result of me slogging through things to figure out the cause for the NullPointerException.

    #2
    Did my support expire?

    Comment


      #3
      Sorry Joe - somebody *is* looking into it, we just neglected to mention that here

      Comment


        #4
        Thanks. Let me know if you need more information. I have the dev console working now, if that can provide any details you'd like.

        Comment


          #5
          Perhaps BaseClass::internalSetID(jsObj) could be changed to check for null after the call to JSOHelper.getAttribute, using SC.generateID() in case the return is null, as in the no-arg constructor.
          Alternatively, new RecordList(jsObj) could call the no-arg base constructor with super() rather than super(jsObj).

          Comment


            #6
            The correct fix we believe is a a null check guarding the registration call in BaseClass::internalSetID(jsObj) - in fact it was thought this was already present.

            The fix should be in the next nightly build of SGWT 3.1p.

            Comment


              #7
              I am also having this issue. The build from May 26th does not have the problem.

              Comment


                #8
                It doesn't look like a fix made it into last night's build.
                I'm running: SmartClient Version: v8.3p_2013-06-12/Enterprise Deployment (built 2013-06-12),
                and I still get the same NullPointerException in IDManager.validateID() when calling getDataAsRecordList() on the DSResponse.

                Looking at the comments in BaseClass, it looks like the intended approach could be to override "registerID()" in RecordList:

                Code:
                    // Some BaseClass descendants don't want to register IDs globally, so
                    // create an override point here to control that.  For safety, we always
                    // want to unregister; it's OK if the object wasn't registered.
                    protected void registerID(String id, boolean skipUniqueJSIdentifierCheck) {
                        IDManager.registerID(this, id, skipUniqueJSIdentifierCheck);
                    }
                Whatever approach works is fine by me--this is slowing down my development and testing because I have to run in compiled mode.

                Comment


                  #9
                  I just tried last night's build (Note: It is the 13/06/2013), and the issue seems to have been resolved for the null pointer. However, I still get these warnings (and they occur in the showcase samples as well):

                  1:37:00.718:XRP2:WARN:Log:Specified ID: isc_ResultSet_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
                  11:37:00.719:XRP2:WARN:Log:Specified ID: isc_ResultSet_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
                  11:37:00.980:XRP9:WARN:Log:Specified ID: isc_ResultSet_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
                  11:37:00.981:XRP9:WARN:Log:Specified ID: isc_ResultSet_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
                  11:37:01.412:XRP6:WARN:Log:Specified ID: isc_ResultSet_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.

                  Comment


                    #10
                    Thanks for the notification. We'll take a look.

                    Comment


                      #11
                      The NullPointerException is gone with the 2013-06-13 build. I apologize for testing with the wrong build; 06-12 was the latest as of 6am this morning and I thought that builds were generated/published around midnight.

                      I do not see any ID collision warnings in the log.

                      Comment


                        #12
                        I've just updated to SmartClient Version: v8.3p_2013-06-13/PowerEdition Deployment (built 2013-06-13) and I'm seeing the same WARN when calling ListGrid.getDataAsRecordList.

                        This line of code: Record fullRecord = theGrid.getDataAsRecordList().get(rowNum);

                        Gets this stack trace.
                        Code:
                        com.smartgwt.client.core.JsObject$SGWT_WARN: 15:52:15.781:TMR4:WARN:Log:Specified ID: isc_ResultSet_35 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
                            at sun.reflect.GeneratedConstructorAccessor64.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                            at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                            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.invokeNativeVoid(ModuleSpace.java:289)
                            at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                            at com.smartgwt.client.util.SC.logWarn(SC.java)
                            at com.smartgwt.client.util.IDManager.validateID(IDManager.java:35)
                            at com.smartgwt.client.util.IDManager.registerID(IDManager.java:78)
                            at com.smartgwt.client.core.BaseClass.registerID(BaseClass.java:63)
                            at com.smartgwt.client.core.BaseClass.internalSetID(BaseClass.java:72)
                            at com.smartgwt.client.core.BaseClass.<init>(BaseClass.java:47)
                            at com.smartgwt.client.data.RecordList.<init>(RecordList.java:68)
                            at com.smartgwt.client.data.ResultSet.<init>(ResultSet.java:132)
                            at com.smartgwt.client.widgets.grid.ListGrid.getResultSet(ListGrid.java:16388)
                            at com.smartgwt.client.widgets.grid.ListGrid.getRecordList(ListGrid.java:16396)
                            at com.smartgwt.client.widgets.grid.ListGrid.getDataAsRecordList(ListGrid.java:13005)
                            at com.islandpacific.gui.client.direct.customerOrders.OrderCurrencyCellFormatter.format(OrderCurrencyCellFormatter.java:24)
                            at sun.reflect.GeneratedMethodAccessor163.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.GeneratedMethodAccessor109.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:680)

                        Comment


                          #13
                          We don't believe the warning affecting ListGrid ResultSets should have any impact on correctness/functionality, but we are looking in how to avoid it being generated. Though the warning is new, the underlying code is behaving as before.

                          Comment


                            #14
                            These warnings should no longer be present in current builds of SGWT 3.1p.

                            Comment


                              #15
                              Is this fixed in the 4.0p nightlies too? I'm getting the same collision warning in 4.0-p20130725 when calling ListGrid.getRecordList()

                              Comment

                              Working...
                              X