commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15170] New: - BeanUtils.setProperty doesn't convert primitive wrappers
Date Mon, 09 Dec 2002 05:18:01 GMT
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

           Summary: BeanUtils.setProperty doesn't convert primitive wrappers
           Product: Commons
           Version: 1.5 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: rg@onepercentsoftware.com


When using BeanUtils.setProperty to set a property of type String, sometimes 
it will be necessary to pass in an object of a primitive wrapper type (i.e. 
java.lang.Integer).  The current implementation throws an 
IllegalArgumentException, ignoring the available toString() method on the 
primitive wrapper.  The current conversion code also will not delegate the 
conversion to ConvertUtils.

Here's an example that illustrates the error:

BeanUtils.setProperty(new BeanComparator("foo"), "property", new Integer(1));

(See the attached testcase for the entire testcase.)

I have proposed a patch for this (see attached).  However, I am not extremely 
familiar with the BeanUtils code.  The patch will, however, enable primitive 
wrapper conversions to work correctly.

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


Mime
View raw message