|
Just reran this and you are correct, the no values is working. Not sure what I had goofed up when I ran into that.
Yes, it appears to just be a number conversion error. When I submitted I didn't think to look for that so their might already be a jira. :) I am on XWorkBasicConverter so I will take a look at this. Do we have a test case for it?
./alex -- .w( the_mindstorm )p. No, just the small app linked to in the description. I'm writing some unit tests for another issue tonight so I might get around to coding one for this.
This patch fixes the empty Number issues. If a value is an empty String do not attempt to use the DefaultConverter if other conversions have failed. (This was what was causing required validation not to work as OGNL was throwing an exception if the DefaultConverter was invoked with an empty string.)
Review the ParsePosition code carefully. That is what the code *Should* be doing to detect issues like "1111aaa" and "111.111" being submitted to Integers (and other numbers). However when the exception is thrown for some reason OGNL still attempts to invoke a method and throws an exception.
Patches applied. Thanks.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* no values when entered (into the personId field) will generate a "personId must be an integer" error message.
* "111aaa" reported no error. I believe this is a bug on XWorkBasicConverter, which convertes "111aaa" into 111. Actually it is NumberFormat.parse("111aaa") returns 1111. We might need to take ParsePosition into account and see if all the source ( eg. "111aaa") is being used to do conversion. So if not all the ParsePosition is used, then there might be an error when converting... What do you think?
* "asdf" gives 'Invalid field Value for Field "persionId"' cause webwork failed to convert it to an Integer.
> no values reports a field error, field required
I think it is reporting an error "persionId must be an integer". Is this what you mean? or am i missing the point? Or do you mean why "invalid field value ...." message is not displayed? The "invalid field ..." message will be display only if there is a failure in the conversion.
I think you are right that there is a bug in the number conversion .... What do you think? ;-)