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

BeanUtilsBean does not convert objects using custom convertors properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • None
    • Linux/Java5

    Description

      BeanUtilsBean.setProperty(Object bean, String name, Object value) cannot properly convert any custom class using convertor.

      Line 1007

      It calls toString() on every object regardless of its type (unless it was a string or an array). This prevent custom convertors from functioning.

      } else if (getConvertUtils().lookup(value.getClass()) != null)

      { newValue = getConvertUtils().convert(value.toString(), type); //<--- WRONG! }

      else

      { newValue = value; }

      }

      Attachments

        Activity

          People

            niallp Niall Pemberton
            jackdog Brad
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: