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

getPropertyType return null on second descendant class

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.8.3
    • Fix Version/s: 2.0.0
    • Component/s: Bean / Property Utils
    • Labels:
      None
    • Environment:

      Oracle JDK 1.7.0.10 and later.

      Description

      PropertyUtils.getPropertyType() for IndexedProperty works only for first invoked descendant class.

      Bug reproduced in JDK 1.7.0.10 - 13. In JDK 1.7.0.9 it works fine. As I see, in JDK 1.7.0.10 java.beans.Introspector was changed, but I don't understand how it works.

      Example

      file is IndexedProperty of the RootBean (attachend to issue) with type ArrayList<String>.

      RoootBean has two empty descendans: FirstChildBean and SecondChildBean.

      RootBean bean = new FirstChildBean();
      Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
      System.out.println(propertyType != null ? propertyType.getName() : null);
      -- Expected: java.lang.String, Actual: java.lang.String
      
      bean = new SecondChildBean();
      propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
      System.out.println(propertyType != null ? propertyType.getName() : null);
      -- Expected: java.lang.String, Actual: null
      

        Attachments

        1. Test.java
          1 kB
          Alex Crown
        2. PropertyUtilsBean.java.patch
          2 kB
          Alex Crown

          Issue Links

            Activity

              People

              • Assignee:
                britter Benedikt Ritter
                Reporter:
                alexcrown Alex Crown
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: