You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2007/05/20 10:22:16 UTC

[jira] Resolved: (BEANUTILS-274) BeanUtils cannot set property of type Long with value of Double

     [ https://issues.apache.org/jira/browse/BEANUTILS-274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved BEANUTILS-274.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.8.0
         Assignee: Niall Pemberton

> 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
>         Assigned To: Niall Pemberton
>             Fix For: 1.8.0
>
>
> 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