Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-274

BeanUtils cannot set property of type Long with value of Double

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              niallp Niall Pemberton
              xkwauk Xianmin Kwauk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: