commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <>
Subject [jira] Commented: (BEANUTILS-357) PropertyUtilsTestCase.testGetReadMethod* fail for abstract properties.
Date Mon, 05 Oct 2009 13:35:31 GMT


Niall Pemberton commented on BEANUTILS-357:


I'm not sure about the inner class example you provide especially when you say:

    * "...did not include my equivalent of 'TestBean.InnerClass' because, I believe, PropertyUtils
returned AbstractTestBean$InnerClass instead of TestBean$InnerClass."

In your example TestBean$InnerClass and AbstractTestBean$InnerClass are one and the same thing
-  InnerClass is declared in AbstractTestBean - TestBean inherits it, but the class is always
AbstractTestBean$InnerClass. But this seems to me to be barking up the wrong tree because
this bug was about the *read method* returning the wrong declaring class. When I tried your
example I found that in the declaring class of the read method for "innerClassProperty" to
be correct - i.e. the concrete sub-class (see the test case for the bug[1]).

Anyway I did some further investigation into the original issue and found that making the
changes you originally described only caused the tests to fail on one particular method -
that was the "booleanSecond" property which has a "isBooleanSecond" getter method. Changing
the getter method name to "getBooleanSecond" resulted in the issue disappearing.

I have added a new test case for this bug here:


Anyway all this is interesting, but its not BeanUtils that is providing the property descriptors
and their get methods - BeanUtils uses java's Introspector[2] and BeanInfo[3] classes to get
the property descriptors, so it looks like a bug in Java to me:

    BeanInfo beanInfo = Introspector.getBeanInfo(beanClass);
    PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();


> PropertyUtilsTestCase.testGetReadMethod* fail for abstract properties.
> ----------------------------------------------------------------------
>                 Key: BEANUTILS-357
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>         Environment: Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
> Linux 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/Linux
>            Reporter: Richard O'Sullivan
>         Attachments:, BEANUTILS-357-AbstractTestBean.patch
> Create org.apache.commons.beanutils.AbstractTestBean with abstract methods for properties
in TestBean and change TestBean to extend AbstractTestBean. Run PropertyUtilsTestCase, the
testGetReadMethod* methods fail because "Correct declaring class for X expected:<...Abstract...>
but was:<......>".

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message