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

[beanutils] copyProperties and null/empty values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.6
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 32851

    Description

      When BeanUtils.copyProperties copies a String property to a BigDecimal property
      it throws ConversionException when the String property is null or "".
      The opposite, when it copies a null BigDecimal property to a String property,
      works fine, the String is set to null.

      When BeanUtils.copyProperties copy a null or "" String property to a Integer
      property, it sets the Integer to 0. The opposite, when I copy a null Integer
      property to a String property it is set to null. Copying a null String to a null
      Integer instead of 0 would be more consistent. (happens with other numeric
      wrapper classes too).

      These 2 issues are problematic when there are optional fields inside a Struts
      ActionForm and the empty values are copied to a TO.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mauricio_noda@hotmail.com Mauricio Noda
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: