This is indeed a bug - we need to catch IllegalArgumentExceptions and wrap
them in TypeMismatchExceptions there as well. Thanks for pointing this out!
It's fixed in CVS HEAD now; should be available in the next nightly
snapshot.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...] On Behalf
Of Justin Fowler
Sent: Friday, July 14, 2006 9:21 AM
To: spr...@li...
Subject: [Springframework-developer] Possible bug in BeanWrapperImpl
Hi All,
I am using a Map as my form backing object. I am registering a
CustomNumberEditor (see below).
protected void initBinder( HttpServletRequest request,
ServletRequestDataBinder binder ) throws Exception
{
super.initBinder( request, binder ); //To change body of
overridden methods use File | Settings | File Templates.
binder.registerCustomEditor( Long.class, "criteriaMap [justin]",
new CustomNumberEditor( Long.class, true ) );
}
This works fine. If i enter a long value into the field, it gets converted
to a long and stored against the property 'justin' in the map. However if
the data entered into the field is invalid. I get the stack tracked
displayed in my browser as apposed to the nice bind errors I would expect to
see.
After some investigation I found the following. (Code taken from the
BeanWrapperImpl:setPropertyValue(....))
If the propVal is of type list. Then the 'convertIfNecessary' method call
is wrapped in a try/catch block. But for a Map it is not.
Just wondering if this is a bug? If so. How would I go about proving a
patch to fix this problem?
Thanks for your help
Justin Fowler
Hyro Servcies Limited
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|