On Sunday, November 11, 2012 7:47:11 PM UTC+1, Daniel Mauricio Patino León wrote:
Seems that edioto framework is trying to get the Double.doubleValue() without check if the object is null.
Any one ?
DoubleBox uses DoubleParser. DoubleParser returns 'null' if the value is the empty string, and otherwise uses a NumberFormat, and throws a ParserException if it cannot parse. Your edited object's property is of type 'double', not 'java.lang.Double', so when the field is empty, getValue() returns 'null', and the Editor framework tries to unbox the 'null' to put it into your 'double' property, hence the NullPointerException. With any illegal value, DoubleParser throws; in that case, the ValueBoxEditor returns the last known value, which explains why it doesn't throw in that case.
I think you can file an issue, but I wonder what the fix should be (if any): what value should be put into your property when the field is empty (i.e. the value is 'null')? or should the Editor framework generate specific code for primitive values to handle nulls and report errors without trying to change the value (to avoid NPEs)?