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

PropertyUtilsBean.copyProperties does not catch NoSuchMethodException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • Bean / Property Utils
    • None
    • Operating System: other
      Platform: Other

    • 35458

    Description

      I ran into a problem where I had a bean that had an IndexedSetter but no simple
      setter. This caused a NoSuchMethodException to get thrown in
      PropertyUtilsBean.copyProperties. This is inconsistant with BeanUtilsBean which
      catches this case and continues copying the other properties.

      When I asked about this in on the mailing list, the answer seemed to come back
      that this is probabaly incorrect behaviour, but it is possible people depend on
      this behaviour so this might be too big a change for a point release. I'm
      attaching the patch so it can be added to the next major release (if it is
      determined to be incorrect behaviour).

      The scenario I ran into this was one where I had a bean that I then used CGLib
      for enhancing. After that, the bean failed to be clonable by BeanUtils.clone.
      This could potentially become a big deal since Hibernate used CGLib for adding
      proxies to beans for lazy loading.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--fixCopyPropertyException
          2 kB
          Will Pugh
        2. Beanutils-92-updated.patch
          3 kB
          Niall Pemberton
        3. Jira92TestCase.java
          3 kB
          Niall Pemberton

        Activity

          People

            niallp Niall Pemberton
            willpugh Will Pugh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: