Skip to content

Processing java.math.BigDecimal via Spring's ExtendedBeanInfo fails sporadically [SPR-10111] #14744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Dec 19, 2012 · 1 comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 19, 2012

Chris Beams opened SPR-10111 and commented

This issue was spawned from #14336. See comments there for background.


Issue Links:

Referenced from: commits 1c306df, 26d5ef9, aa3e0be

Backported to: 3.1.4

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

commit 3e19b484efb1e5e490b649e2fd6c4a0ced55b34d
Author: Chris Beams <cbeams@vmware.com>
Commit: Chris Beams <cbeams@vmware.com>

    Handle non-void write methods deterministically
    
    This change resolves a specific issue with processing
    java.math.BigDecimal via ExtendedBeanInfo. BigDecimal has a particular
    constellation of #setScale methods that, prior to this change, had the
    potential to cause ExtendedBeanInfo to throw an IntrospectionException
    depending on the order in which the methods were processed.
    
    Because JDK 7 no longer returns deterministic results from
    Class#getDeclaredMethods, it became a genuine possibility - indeed a
    statistical certainty that the 'wrong' setScale method handling order
    happens sooner or later. Typically one could observe this failure once
    out of every four test runs.
    
    This commit introduces deterministic method ordering of all discovered
    non-void returning write methods in such a way that solves the problem
    for BigDecimal as well as for any other class having a similar method
    arrangement.
    
    Also:
    
     - Remove unnecessary cast
    
     - Pass no method information to PropertyDescriptor superclasses when
       invoking super(...). This ensures that any 'type mismatch'
       IntrospectionExceptions are handled locally in ExtendedBeanInfo and
       its Simple* PropertyDescriptor variants where we have full control.
    
    Issue: SPR-10111, SPR-9702

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant