commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xianmin Kwauk (JIRA)" <j...@apache.org>
Subject [jira] Created: (BEANUTILS-274) BeanUtils cannot set property of type Long with value of Double
Date Mon, 02 Apr 2007 13:54:32 GMT
BeanUtils cannot set property of type Long with value of Double
---------------------------------------------------------------

                 Key: BEANUTILS-274
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-274
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Bean / Property Utils, ConvertUtils & Converters
    Affects Versions: 1.7.0
         Environment: Windows XP, JDK 1.6.0
            Reporter: Xianmin Kwauk


I tried to set a field of type Long with a double value (e.g. 100.0) and I got 0. 

In BeanUtilsBean, in the following code:

} else if (getConvertUtils().lookup(value.getClass()) != null) {
                newValue = getConvertUtils().convert(value.toString(), type);
            } else {

value.toString() is passed to LongConverter which would handle value (Double) correctly but
fails when a String (e.g. "100.0") is passed in. It seems changing "value.toString()" to "value"
should fix the problem.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
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