Skip to content
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

SPEL: Inconsistent implementation of ReflectivePropertyResolver - canRead vs. read for null targets [SPR-5663] #10334

Closed
spring-projects-issues opened this issue Apr 8, 2009 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Oliver Becker opened SPR-5663 and commented

The method canRead() in org.springframework.expression.spel.support.ReflectivePropertyResolver returns false if target is null.
However, the method read() returns null for a null target. According to the contract specified by canRead it should throw an AccessException in this case.


Affects: 3.0 M2

Referenced from: commits d34a2c5

@spring-projects-issues
Copy link
Collaborator Author

Andy Clement commented

I'm guessing this doesn't actually affect anything you are doing - it is just an observation about the code?

The read() method won't be invoked if canRead() already said it can't read it.

Anyway, I've now fixed it to make them consistent (and consistent with write/canWrite).

tests added also (although I think ReflectivePropertyResolver could do with a few more since it is only at 74% coverage)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants