Skip to content

GenericTypeAwarePropertyDescriptor warns when creating java.security.SecureRandom bean [SPR-6399] #11065

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 Nov 20, 2009 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 20, 2009

Nickolay Mazurkin opened SPR-6399 and commented

I create a bean with java.security.SecureRandom type property which is injected.

GenericTypeAwarePropertyDescriptor warns me that SecureRandom has ambiguous write methods with the following message.

Invalid JavaBean property 'seed' being accessed! Ambiguous write methods found next to actually used [public void java.security.SecureRandom.setSeed(long)]: [public synchronized void java.security.SecureRandom.setSeed(byte[])]

I fully understand that it does mean. But java.security.SecureRandom is a JDK's class and I can do nothing to make this bean properly formed. And I don't want to see this warn message in my log too.


Affects: 3.0 RC2

Issue Links:

Referenced from: commits 61f2371

@spring-projects-issues
Copy link
Collaborator Author

Nickolay Mazurkin commented

To see such warn messages just create a simple bean.

<bean id="sr" class="java.security.SecureRandom"/>
P.S. Spring 3.0 RC1 was just fine in that case

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 24, 2009

Costin Leau commented

See #9606. The class (though it's part of the JDK) doesn't respect the JavaBeans conventions which can cause problems when the application is moved to a different VM.
The warning purpose is to notify users about this risk.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

It seems that the check is a bit too eager there and reporting warnings for bean properties that are not actually used at that point. I'll revisit this in time for 3.0 GA.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've relaxed this warning about ambiguous setters to only be logged in case of actual write access: i.e. when saying <property name="seed" value="...">, where the resolution of the setter method being used at runtime is ambiguous indeed and might lead to a different method being chosen in different VM environments. Pure introspection of the write method will not lead to the warning being logged anymore.

Juergen

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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants