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/08/20 04:23:49 UTC
DO NOT REPLY [Bug 16525] -
BeanUtils.setProperty is over-zealous at converting types
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=16525>.
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=16525
BeanUtils.setProperty is over-zealous at converting types
------- Additional Comments From scott_howlett@yahoo.com 2003-08-20 02:23 -------
I just ran into the same problem - my value is converted to a String
unnecessarily by BeanUtils.setProperty(). Unfortunately, the calling code is
not mine so I don't have an easy option of switching to copyProperty() instead.
It seems to me, though, that there is a simple solution. The toString()
conversion performed in this line from setProperty:
newValue = getConvertUtils().convert(value.toString(), type);
shouldn't be necessary. Although ConvertUtils.convert() wants a String value,
it just passes it to a Converter that can take any Object as a value.
Why not change ConvertUtils.convert() to accept an Object value and avoid
having BeanUtils convert it to a String first? That way, converters will still
get first crack at a conversion.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org