You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/06/06 16:35:11 UTC

DO NOT REPLY [Bug 20549] New: - Handling of exceptions thrown during BeanUtils.populate

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20549>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20549

Handling of exceptions thrown during BeanUtils.populate

           Summary: Handling of exceptions thrown during BeanUtils.populate
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ericpabst@discoverfinancial.com
                CC: ericpabst@discoverfinancial.com


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

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org