commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baptiste MATHUS (JIRA)" <>
Subject [jira] Commented: (BEANUTILS-175) [beanutils] Handling of exceptions thrown during BeanUtils.populate
Date Sun, 03 Jun 2007 08:30:15 GMT


Baptiste MATHUS commented on BEANUTILS-175:

To answer (well, four years later... :)) about it: I think this class could in fact be added
for the best of both worlds: the PropertyUtilsBean class would use the default ExceptionHandler
implementation that would behave exactly like now, and other implementations could just return
null if wanted when accessing say "a.b" with a being null.

> [beanutils] Handling of exceptions thrown during BeanUtils.populate
> -------------------------------------------------------------------
>                 Key: BEANUTILS-175
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: Bean / Property Utils
>         Environment: Operating System: All
> Platform: All
>            Reporter: Eric Pabst
>            Priority: Minor
>             Fix For: LATER THAN 1.8.0
> I run into a problem when using Struts to populate request parameters to a 
> form's nested property when either the conversion from String to int (for 
> example) fails or when the set method in the nested bean throws an exception 
> such as IllegalArgumentException.  
> I propose that we add a property to BeanUtilsBean for a new interface called 
> something like PopulateExceptionHandler which will have a method something like
>     void execute(Exception exception, Object bean, String propertyPath, Object 
> value)
> Then, within BeanUtilsBean.populate, within the loop, it would catch any 
> exception, and call the populateExceptionHandler's execute method with it 
> (unwrapping InvocationTargetException's).  The default handler would just 
> rethrow it (or we could have no default handler, and if no handler is present, 
> the BeanUtils method rethrows it).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message