Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

SmartClient 9.1 introduced "Invocation threw exception java.lang.NullPointerExcerror"

$
0
0
We recently upgraded to SmartClient 9.1 (see the exact version below) from 8.3. And, unfortunately, we are throwing errors that we weren't getting previously.

We're executing a fetch utilizing an advancedCriteria from javascript which includes a DMI call that adds an additional criteria to the database fetch.

Javascript:
Code:

getPickListFilterCriteria: function() {
    return isc.DataSource.convertCriteria(
      {
                      "SOME1_ID": this.grid.getFilterValue( this.rowNum, "SOME1_ID" ),
              "SOME2_ID": this.grid.getFilterValue(  this.rowNum, "SOME3_ID"),
              "SOME3_ID": this.grid.getFilterValue( this.rowNum, "SOME3_ID")
      }); 
}

Some of these values more than likely null.

What I see from the Console is:
Code:

criteria:{
        _constructor:"AdvancedCriteria",
        operator:"and",
        criteria:[
            {
                fieldName:"SOME1_ID",
                operator:"equals",
                value:13
            },
            {
                fieldName:"SOME2_ID",
                operator:"iContains",
                value:null
            },
            {
                fieldName:"SOME3_ID",
                operator:"iContains",
                value:null
            }
        ]
    }

The Java DMI Code looks like this:
Code:

        public DSResponse applyStatusFilter(DSRequest dsRequest, HttpServletRequest servletRequest) throws Exception {
                dsRequest.addToCriteria("STATUS","notEqual","H");
                return dsRequest.execute();
        }

And the error I get back is:
Code:

DEBUG DataSourceDMI - Invocation threw exception
java.lang.NullPointerException
        at com.isomorphic.criteria.LogicalOperator.convertToMap(LogicalOperator.java:70)
        at com.isomorphic.criteria.AdvancedCriteria.getCriteriaAsMap(AdvancedCriteria.java:234)
        at com.isomorphic.datasource.DSRequest.setAdvancedCriteria(DSRequest.java:1031)
        at com.isomorphic.datasource.DSRequest.addToCriteria(DSRequest.java:5873)
        at com.isomorphic.datasource.DSRequest.addToCriteria(DSRequest.java:5801)
        at com.isomorphic.datasource.DSRequest.addToCriteria(DSRequest.java:5706)

I did some testing with it and found the following workarounds:

A. Changing the fetch to use a plain "criteria" instead of the advancedCriteria makes the error go away.
B. If I change the way the advancedCriteria is generated so that it forces an operator of "equals" instead of "iContains", the issued goes away.
Code:

      getPickListFilterCriteria: function() {
                return {
                                _constructor:"AdvancedCriteria",
                                operator:"and",
                                criteria:[
                                    // this is a Criterion
                                    { fieldName:"TABLECLAUSE_CID_ID", operator:"equals", value:"13" },
                                    { fieldName:"TABLECLAUSE_PAS_ID", operator:"equals", value:null },
                                    { fieldName:"TABLECLAUSE_RIC_ID", operator:"equals", value:null }
                                ]
                            };
                        }

I wish I could go back to 8.3 and run the same tests, but I'm afraid I don't have that kind of time. And while the workaround on the Javascript side is simple, you can probably guess which method I used extensively throughout my code.

Any help would be appreciated. Thanks.

Paul Fincke
paul.fincke@seguetech.com
-----------------------------------------------------------------
Be sure your post includes:

1. Version: SNAPSHOT_v9.1d_2014-01-27/PowerEdition Development Only (built 2014-01-27)

2. Browser: Firefox 30.0

4. RPC tab in the Developer Console
[
{
affectedRows:0,
invalidateCache:false,
isDSResponse:true,
queueStatus:-1,
status:-1,
data:null
}
]

Viewing all articles
Browse latest Browse all 4756

Trending Articles