Announcement

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

    Null pointer exception in server code with latest nightly build

    SmartClient Version: SC_SNAPSHOT-2011-04-14/PowerEdition Deployment (built 2011-04-14)

    With no other changes to our code I'm getting this error after upgrading to the latest nightly build.
    Code:
    === 2011-04-14 18:39:38,694 [0-17] WARN  RequestContext - dsRequest.execute() failed: 
    java.lang.NullPointerException
    	at com.isomorphic.criteria.AdvancedCriteria.getFieldValue(AdvancedCriteria.java:82)
    	at com.isomorphic.criteria.AdvancedCriteria.getFieldValue(AdvancedCriteria.java:68)
    	at com.isomorphic.datasource.DSRequest.getCriteriaValue(DSRequest.java:1214)
    	at com.isomorphic.datasource.DSRequest.getFieldValue(DSRequest.java:1208)
    	at com.islandpacific.gui.server.customDataSource.PoItemDS.setDefaultsForExistingStyle(PoItemDS.java:2301)
    	at com.islandpacific.gui.server.customDataSource.PoItemDS.getDefaults(PoItemDS.java:1664)
    	at com.islandpacific.gui.server.customDataSource.PoItemDS.execute(PoItemDS.java:443)
    	at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
    	at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    	at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1492)
    The line of code in our server side method that is getting the error is this.
    Code:
    String poCurrency = req.getFieldValue(HCUR)==null? "" 
    	: req.getFieldValue(HCUR).toString().trim();
    The request being sent by the client looks like this.
    Code:
    {
        "dataSource":"PoItem", 
        "operationType":"custom", 
        "operationId":"custom_PoItem_member(F927)getDefaults", 
        "data":{
            "IONO":"TEST280", 
            "IFGP":"927", 
            "ItemNumber":"0280-00280-0155", 
            "IPPK":"N", 
            "HCUR":"", 
            "HODI":"2011-04-14T05:00:00"
        }, 
        "willHandleError":true, 
        "showPrompt":true, 
        "oldValues":{
            "IONO":"TEST280", 
            "IFGP":"927", 
            "ItemNumber":"0280-00280-0155", 
            "IPPK":"N", 
            "HCUR":"", 
            "HODI":"2011-04-14T05:00:00"
        }, 
        "requestId":"PoItem$627132"
    }
    I can work around it by changing the code to this.
    Code:
    String poCurrency = req.getValues().get(HCUR)==null? "" 
    	: req.getFieldValue(HCUR).toString().trim();
    But you may want to fix the getFieldValue() method to handle nulls like it used to so others can avoid this regression.

    #2
    Hi Jay, thanks for the thorough report - this is now fixed.

    Comment


      #3
      I'm getting a similar error with recent builds, including the download from 6/13:
      SmartClient Version: v8.3p_2013-06-13/Enterprise Deployment (built 2013-06-13)

      I get a NullPointerException when trying to get a field value:
      Code:
      rendition = (String) dsRequest.getFieldValue("rendition");
      Stacktrace:
      Code:
      2013-06-14 13:14:46,897 ERROR [com.hyperproductive.libraries.richclient.support.server.dmi.BaseDMIHandler] (http-0.0.0.0-8080-1) add operation failed
      java.lang.NullPointerException
                     at com.isomorphic.criteria.AdvancedCriteria.getFieldCriterion(AdvancedCriteria.java:185)
                     at com.isomorphic.criteria.AdvancedCriteria.getFieldCriterion(AdvancedCriteria.java:178)
                     at com.isomorphic.criteria.AdvancedCriteria.getFieldCriterion(AdvancedCriteria.java:169)
                     at com.isomorphic.criteria.AdvancedCriteria.getFieldValue(AdvancedCriteria.java:147)
                     at com.isomorphic.datasource.DSRequest.getCriteriaValue(DSRequest.java:1651)
                     at com.isomorphic.datasource.DSRequest.getFieldValue(DSRequest.java:1635)
                     at com.hyperproductive.server.dmi.CustomDMIHandler.performCustomAddOperations(CustomDMIHandler.java:131)
                     at com.hyperproductive.libraries.richclient.support.server.dmi.BaseDMIHandler.executeAdd(BaseDMIHandler.java:170)
                     at com.hyperproductive.libraries.richclient.support.server.dmi.BaseDMIHandler$$FastClassByCGLIB$$182db750.invoke(<generated>)
                     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
                     at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618)
                     at com.hyperproductive.server.dmi.CustomDMIHandler$$EnhancerByCGLIB$$56b5570d.executeAdd(<generated>)
                     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.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:972)
                     at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416)
                     at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
                     at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2030)
                     at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216)
                     at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
                     at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
                     at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                     at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                     at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:191)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
                     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:534)
                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
                     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                     at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74)
                     at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
                     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
                     at java.lang.Thread.run(Thread.java:662)
      Here is the data being processed:
      Code:
      {
          dataSource:"testDataSource", 
          operationType:"add", 
          componentId:"isc_DynamicForm_8", 
          data:{
              status:1, 
              language:10, 
              languageDescription:"English", 
              sender:99, 
              attachment:null,
              rendition:null
          }, 
          callback:{
              target:[DynamicForm ID:isc_DynamicForm_8], 
              methodName:"saveReply"
          }, 
          showPrompt:true, 
          prompt:"Saving form...", 
          oldValues:{
          }, 
          requestId:"testDataSource$62775", 
          clientContext:{
          }, 
          fallbackToEval:false, 
          afterFlowCallback:"isc_DynamicForm_8.$49z(dsRequest, dsResponse, data)", 
          editor:[DynamicForm ID:isc_DynamicForm_8], 
          bypassCache:true
      }

      Comment


        #4
        Yes. We're getting the same error again too.

        Comment


          #5
          Just a note to say that we're investigating this. We'll update this thread when we have a resolution.

          Regards
          Isomorphic Software

          Comment


            #6
            We've made a change to fix this. The fix will be in nightly builds of 3.1p and 4.0d as of tomorrow, 6/16. Please try it with your use case and let us know if you still see problems

            Comment


              #7
              Fixed. Thanks.

              Comment


                #8
                SmartGWT/3.1p/PowerEdition/2013-06-16

                I am still getting a null pointer exception in the following code:

                Code:
                	private void updateLandedCosts(DSResponse resp) throws Exception {
                		
                		Map map = resp.getDataMap();
                		
                		Integer orderId = (Integer)resp.getFieldValue(ProductionOrder.ID);
                I added the getDataMap() line as a test. It returns null. The sql when run manually does update the database.


                === 2013-06-17 09:07:33,669 [er-2] INFO SQLDriver - [builtinApplication.null, builtinApplication.recalculateDestinationTotals] Executing SQL update on 'iptsfili': UPDATE ProductionDestination
                SET unitsOrd = integer(ceiling(double(ProductionDestination.unitsOrd)/
                double((select lotSize from ProductionDelivery where ProductionDelivery.id=ProductionDestination.parentId)))
                *(select lotSize from ProductionDelivery where ProductionDelivery.id=ProductionDestination.parentId))
                where parentId in (select id from ProductionDelivery
                where parentId in (select id from ProductionLine
                where parentId in (select ProductionOrder.id from ProductionOrder where
                (ProductionOrder.id=3314))) and lotSize IS NOT NULL and lotSize!=0)
                java.lang.NullPointerException
                at com.isomorphic.datasource.DSResponse.getFieldValue(DSResponse.java:1084)
                at com.islandpacific.gui.server.purchasing.productionorder.ProductionOrderDS.updateLandedCosts(ProductionOrderDS.java:441)
                at com.islandpacific.gui.server.purchasing.productionorder.ProductionOrderDS.executeUpdate(ProductionOrderDS.java:419)
                at com.isomorphic.datasource.DataSource.execute(DataSource.java:1383)

                Comment


                  #9
                  I was getting the error when calling getFieldValue() on the inbound DSRequest, rather than on the DSResponse as in your case.

                  Comment


                    #10
                    We've added a null-guard to DSResponse.getFIeldValue() which will prevent the actual crash, but the reason it's crashing in the first place is that the response data is null, and it sounds like you're saying you expect the response to contain data.

                    It's impossible to say from this snippet whether the response should have data or not. We can comment further if you post your .ds.xml file and the entirety of ProductionOrderDS.java

                    Thanks,
                    Isomorphic Software Support

                    Comment

                    Working...
                    X