PDA

View Full Version : [FIXED] [2.0 Trunk] NullPointerException while record.set("property", null);



takayser
28 Apr 2009, 4:17 AM
Trying to set null in a property on a record throws a NullPointerException.

There is no check for null values and therefore the equals method throws a NullPointerException

Record.java:266

if (!modified.containsKey(name)) {
modified.put(name, model.get(name));
} else if(modified.get(name).equals(value)){
dirty = false;
modified.remove(name);
validMap.remove(name);
}Suggestion:

if (!modified.containsKey(name)) {
modified.put(name, model.get(name));
} else {
Object modifiedValue = modified.get(name);
if (modifiedValue == value || (modifiedValue != null && modifiedValue.equals(value))) {
dirty = false;
modified.remove(name);
validMap.remove(name);
}
}

sven
13 May 2009, 8:19 AM
Fixed in SVN.