Skip to content

Regression - Introspection with BeanUtils started failing for java.awt.Component derived classes [SPR-8491] #13137

Closed

Description

@spring-projects-issues

Tuomas Kiviaho opened SPR-8491 and commented

java.awt.Component has both

public void setSize(int width, int height)
and
public void setSize(Dimension d)

introspection of classes derived from this base class (using BeanUtils.getPropertyDescriptor) now crashes with following exception

...
Caused by: java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: size
at java.beans.IndexedPropertyDescriptor.findIndexedPropertyType(IndexedPropertyDescriptor.java:341)
at java.beans.IndexedPropertyDescriptor.setIndexedWriteMethod(IndexedPropertyDescriptor.java:248)
at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:233)
at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:178)
at org.springframework.beans.ExtendedBeanInfo.<init>(ExtendedBeanInfo.java:108)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:224)
... 92 more

I guess that this can be omitted by first checking whether or not index method really has to be updated or not (it seems to be already null)


Affects: 3.1 M2

Attachments:

Issue Links:

3 votes, 5 watchers

Activity

  1. spring-projects-issues commented on Jun 27, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Tuomas Kiviaho commented

    This turned out to be quite fatal for me since beanWrapper.getPropertyDescriptors suffers from the same problem thus preventing creation of all Swing based beans.

    java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: size
    at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:262)
    at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)
    at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:304)
    at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:311)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1208)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1069)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    ... 81 more
    Caused by: java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: size
    at java.beans.IndexedPropertyDescriptor.findIndexedPropertyType(IndexedPropertyDescriptor.java:341)
    at java.beans.IndexedPropertyDescriptor.setIndexedWriteMethod(IndexedPropertyDescriptor.java:248)
    at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:233)
    at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:178)
    at org.springframework.beans.ExtendedBeanInfo.<init>(ExtendedBeanInfo.java:108)
    at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:224)
    ... 87 more

  2. spring-projects-issues commented on Jun 29, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Hi Tuomas, thanks for the report. Would you be willing to submit a small project that reproduces this issue based on the instructions at https://github.com/SpringSource/spring-framework-issues#readme ?

    It certainly sounds like an issue, and we'll look into it in any case, but this will help us to prioritize it and get to it quickly. Thanks!

  3. spring-projects-issues commented on Jul 3, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Tuomas Kiviaho commented

    Tried the git push approach but failing many times after trying several ways (with Windows machine) I gave up and used the good-old-way.

    Reproduction of the issue was a bit tricky since introspection seems to either fail with size or location properties or not at all depending on the order of method/property descriptors it is given.
    What the correct result of the introspection might be (other than not failing) is just a suggestion.

  4. spring-projects-issues commented on Oct 25, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Haroldo de Oliveira Pinheiro commented

    For a quick-and-dirty test:

    org.springframework.beans.BeanUtils.getPropertyDescriptors(javax.swing.JButton.class);

    Seems to fail every single time.

  5. spring-projects-issues commented on Nov 25, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Tuomas,

    Thanks for the reproduction project. Try upgrading to 3.1.0.BUILD-SNAPSHOT and you'll see most of the issues are resolved thanks to some fixes that just got in for #13448.

    The reproLocation... and reproSize... methods do still fail and that's probably a legitimate issue where ExtendedBeanInfo is getting confused about read methods in situations where there is a non-standard arrangement of write methods (which is exactly the case with the 'size' and 'location' properties. Keep in mind here that the standard JavaBeans Introspector class completely gives up on these properties -- it's only because of our aggressive approach to finding every possible property that we pick these up at all.

    So, please take a look under the latest snapshot and confirm the fixes on your end. If the size and location issues remain important for you, please open a separate issue and mention this one when you do.

    Cheers,

    Chris

    P.S. I've committed the reproduction project to spring-framework-issues, including updating to 3.1.0.BUILD-SNAPSHOT

  6. spring-projects-issues commented on Nov 25, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    A general note to watchers of ExtendedBeanInfo-related issues: #14663 is a major refactoring of ExtendedBeanInfo and overall support for non-void returning setter methods.

    If you have submitted a reproduction project with this issue, we have run it through its paces against these new changes, but we would like to ask you to do the same against your actual applications.

    Please consider updating your dev or test builds to work against 3.1.4.BUILD-SNAPSHOT and/or 3.2.0.BUILD-SNAPSHOT to verify, and we would appreciate any feedback, even if it's to let us know that all is well. So that we can consolidate feedback, please add your comments to #14663, and mention the original issue(s) that you were watching.

    Thanks!

    Note also that testing against 3.1.4 is preferable to 3.2.0 because ExtendedBeanInfo is always in the code path in the latter, while in 3.2.0 we've optimized things such that ExtendedBeanInfo is only in play for bean classes that have one or more non-void returning setter methods.

  7. added
    type: bug
    in: core
    status: duplicate
    and removed
    type: bug
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions