Sunday, November 11, 2012

Re: DoubleBox and Editor framework bug?



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)?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/tSQEZlBuq5kJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate