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=15170>. 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=15170 BeanUtils.setProperty doesn't convert primitive wrappers [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | ------- Additional Comments From [EMAIL PROTECTED] 2002-12-11 06:17 ------- Rodney, Thanks for committing the converter code and adding the testcase. Unfortunately, these fixes do not address the bug I reported here. This bug only occurs when attempting to set a String property using a number wrapped in a primitive wrapper class. In order to illustrate this behavior, add the following lines to the new testcase testSetPropertyOnPrimitavieWrappers() [sic]: BeanUtils.setProperty(bean,"stringProperty", new Integer(1)); assertEquals(1,Integer.parseInt(bean.getStringProperty())); (i.e. set a String property instead of an int property.) In this case, the ConvertUtils code is never called. The if block beginning around line 901 (comment: "Value into scalar") maps this case to the final else case, which will attempt to set the property using the wrapper class (which will fail). I believe you need to add another check for primitive wrapper classes (or perhaps something more generic like testing the existence of a suitable converter), as I did in my suggested patch. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
