Skip to content

JCacheCache doesn't recognize null values in other JVMs [SPR-13553] #18129

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 Oct 8, 2015 · 3 comments
Assignees
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 Oct 8, 2015

John J Kennedy opened SPR-13553 and commented

The JCacheCache class uses an instance variable called "NULL_HOLDER" to check for a null value. The problem is that it uses == as the test. This won't work in multiple JVMs since one JVM could put a value in cache and another could retrieve it.

I believe it should use a class-based comparision like
storeValue.getClass() == NullHolder.class


Affects: 3.2.14, 4.1.7, 4.2.1

Issue Links:

Referenced from: commits de93290, 6c138d3, 112781f

Backported to: 4.1.8, 3.2.15

@spring-projects-issues
Copy link
Collaborator Author

John J Kennedy commented

I can make a pull-request for this, if you want.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Indeed, the NullHolder class should be designed to expect unique deserialization. The cleanest approach would be to declare a readResolve() method that always resolves to the canonical instance. I'll have a look at this for 4.2.2 and 4.1.8 still.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Addressed in 4.2.2 through a larger refactoring towards the new AbstractValueAdaptingCache base class. To be backported to 4.1.8 in a minimal form, just adding readResolve() declarations.

Juergen

@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 4.2.2 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

2 participants