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

Caching null values #1607

Closed
anwfr opened this issue Nov 13, 2016 · 1 comment
Closed

Caching null values #1607

anwfr opened this issue Nov 13, 2016 · 1 comment
Labels

Comments

@anwfr
Copy link

anwfr commented Nov 13, 2016

It looks like caching NULL values is not supported by Ehcache 3.

A NullPointerException is raised from EhCache.put
Caused by: java.lang.NullPointerException: null
at org.ehcache.core.Ehcache.checkNonNull(Ehcache.java:615) ~[ehcache-3.1.3.jar:3.1.3 5a797f0]
at org.ehcache.core.Ehcache.checkNonNull(Ehcache.java:621) ~[ehcache-3.1.3.jar:3.1.3 5a797f0]
at org.ehcache.core.Ehcache.put(Ehcache.java:193) ~[ehcache-3.1.3.jar:3.1.3 5a797f0]
at org.ehcache.jsr107.Eh107Cache.put(Eh107Cache.java:181) ~[ehcache-3.1.3.jar:3.1.3 5a797f0]

Can you confirm that this is intended behavior? Thx

@ljacomet
Copy link
Member

Hello,

Thanks for your interest in Ehcache 3.

We request that users start the conversation on the google group ehcache-users before opening issues.


Indeed, you cannot cache a null value, this is also the behaviour of the JCache specification.

If you need this in your application, either create a sentinel value or wrap your values from your application.

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

No branches or pull requests

2 participants