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

PropertyUtilsBean.isReadable/isWriteable always returns false for mapped properties

    XMLWordPrintableJSON

Details

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

    • 36980

    Description

      PropertyUtilsBean.isReadable/isWriteable always returns false for mapped
      properties because it does not account for them. The core logic within the try
      block of the isReadable method should look as follows (the logic for
      isWriteable should be updated similarly):

      PropertyDescriptor desc =
      getPropertyDescriptor(bean, name);
      if (desc != null) {
      Method readMethod = desc.getReadMethod();
      if (readMethod == null) {
      if (desc instanceof IndexedPropertyDescriptor)

      { readMethod = ((IndexedPropertyDescriptor) desc).getIndexedReadMethod (); }

      else if (desc instanceof MappedPropertyDescriptor)

      { readMethod = ((MappedPropertyDescriptor) desc).getMappedReadMethod (); }

      }
      return (readMethod != null);
      } else {
      return (false);
      }

      Attachments

        Issue Links

          Activity

            People

              niallp Niall Pemberton
              cjdaniels4@gmail.com Chuck Daniels
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: