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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to