commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Crown (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BEANUTILS-422) getPropertyType return null on second descendant class
Date Tue, 19 Feb 2013 17:29:13 GMT

    [ https://issues.apache.org/jira/browse/BEANUTILS-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13581461#comment-13581461
] 

Alex Crown commented on BEANUTILS-422:
--------------------------------------

I investigated problem more accuratly. 
Bug caused by "Workaround for Bug 28358" in _org.apache.commons.beanutils.PropertyUtilsBean#getPropertyDescriptors_.
There we fill read/write methods for indexed properties with collections. 

When getPropertyType executes for second ancestor, this methods exists in PropertyDescriptor
and _java.beans.IndexedPropertyDescriptor#findIndexedPropertyType_ fails on "type mismatch
between indexed and non-indexed methods: ". It await array in PropertyDescriptor.propertyType,
but there is ArrayList. 
As I understand, Collestions in Indexed properties contrary to the JavaBeans specification
1.1.

In !PropertyUtilsBean.java.patch! I clear Introcpector cache for affected classes. After cleaning
it works fine. 
                
> getPropertyType return null on second descendant class
> ------------------------------------------------------
>
>                 Key: BEANUTILS-422
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-422
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.3
>         Environment: Oracle JDK 1.7.0.10 and later.
>            Reporter: Alex Crown
>            Assignee: Oliver Heger
>         Attachments: PropertyUtilsBean.java.patch, test.zip
>
>
> 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*.
> {code}
> 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
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message