commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Cipriani <>
Subject Making BeanUtils.populate() fail on parse error?
Date Mon, 23 Feb 2009 17:16:28 GMT
Currently I am using BeanUtils.populate() to fill a bean with values
from a map (specifically, with values from the parameter map of an
HttpServletRequest). However, I noticed that when there is a parse
error for a field, populate() sets some default value rather than
failing. E.g. if there is a Long property but the corresponding string
in the map is "abc", the property is silently set to 0.

What's the most convenient way to use the beanutils package to fill a
bean from a parameter map but also be notified if a parse error
occurs? Is there some way to configure populate() to throw an
exception, or to otherwise check the conversion status afterwards? Is
there something else in the library that does this?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message