PDA

View Full Version : Store.isCurrentValue() NullPointerException



mrjoe
19 Dec 2011, 11:33 AM
There is a bug in Store.java (GXT 3.0-beta1)


public boolean isCurrentValue(M model) {
return (access.getValue(model) == null && value == null) || access.getValue(model).equals(value);
}


If previous value was null and new value is not null, then function throws NullPointerException.
Because access.getValue(model) returns null reference.

I'm using GridRowEditing for editing my grid.


final GridEditing<AuthorProxy> editing = new GridRowEditing<AuthorProxy>(grid);
editing.addEditor(cc1, new TextField());

Workaround

Set fields (if possible) to non-null values before inserting to store.


final AuthorProxy authorMutable = authorRequest.edit(author);
authorMutable.setNameFirst("");
authorMutable.setNameLast("");