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 21851] New: - BeanUtils.populate fails with DoubleLocaleConverter on integer values
Date Thu, 24 Jul 2003 12:39:06 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=21851>.
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=21851

BeanUtils.populate fails with DoubleLocaleConverter on integer values

           Summary: BeanUtils.populate fails with DoubleLocaleConverter on
                    integer values
           Product: Commons
           Version: 1.6 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: dpredovic@web.de


BeanUtils.populate fails with "java.lang.IllegalArgumentException: argument type
mismatch" when assigning strings containing integer values (like "123"), if they
are converted through DoubleLocaleConverter, because DecimalFormater.parse()
returns Long and not Double when possible.

My fix is:

DoubleLocaleConverter.java:

    protected Object parse(Object value, String pattern) throws ParseException {
        Number result = (Number) super.parse(value, pattern);
        return new Double(result.doubleValue());
    }

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


Mime
View raw message