Hi,

I'm binding a form parameter to the form via a non-trivial setter:

public void setValue(BigDecimal value) {
   valueInternal = value.scaleByPowerOfTen(4).intValueExact();
}// makes sure we don't loose precision

I'm also validating this field:

@Validate(field = "value", required = true, expression = "this > 0")

The problem is, when the setter throws an exception (for example in this 
case it will fail on 1,00000001), Stripes will continue instead of 
returning to the source page and showing validation errors. What is 
more, the missing value will usually cause an exception much deeper in 
the application code, where it is expected to be valid.

I'm not sure how this should be handled, I'll probably do my own 
PropertyBinder which in handlePropertyBindingError adds validationErrors 
for all fields not binding correctly (because handlePropertyBindingError 
doesn't have a ValidationMetadata argument, which would allow me to add 
it only to validated properties). Regardless, I think Stripes should not 
continue execution if there are binding errors on positively validated 
properties.

--
Best,
Piotr Gliźniewicz


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to