SmartGWT Version: Smart GWT Pro Edition 4.0p (2013-12-18 nightly)
We are migrating to SmartGWT Pro 4.0 and have encountered a NullPointerException in the com.smartgwt.client.data.Criterion class. In our case the this.getCriteria() call returns null, which causes the "this.getCriteria().length" call in the else block to throw a NullPointerException.
We are migrating to SmartGWT Pro 4.0 and have encountered a NullPointerException in the com.smartgwt.client.data.Criterion class. In our case the this.getCriteria() call returns null, which causes the "this.getCriteria().length" call in the else block to throw a NullPointerException.
Code:
public void addCriteria(Criterion c) { String opString = this.getAttributeAsString("operator"); if (opString != null && opString.equals(OperatorId.AND.getValue())) { appendToCriterionList(c); } else { if (this.getAttributeAsObject("value") != null || this.getCriteria().length != 0) { Criterion thisCopy = new Criterion(this); JSOHelper.deleteAttributeIfExists(jsObj, "fieldName"); JSOHelper.deleteAttributeIfExists(jsObj, "value"); Criterion[] criteriaList = { thisCopy, c }; buildCriterionFromList(OperatorId.AND, criteriaList); } else { buildCriterionFromList(OperatorId.AND, new Criterion[] {c}); } } } public Criterion[] getCriteria() { JavaScriptObject[] jsCriteria = JSOHelper.getAttributeAsJavaScriptObjectArray(getJsObj(), "criteria"); if (jsCriteria == null) return null; Criterion[] criteria = new Criterion[jsCriteria.length]; for (int i = 0; i < jsCriteria.length; i++) { criteria[i] = Criterion.getOrCreateRef(jsCriteria[i]); } return criteria; }
Comment