play-plugins
play-plugins copied to clipboard
Redis Plugin: NullpointerException when setting null
I'm trying to use Redis Plugin with my Play 2.4 Java application.
When I set null value to Redis through Cache API, I get NullPointerException at https://github.com/playframework/play-plugins/blob/0642612c9a1c066b501a5c18aafaaad62d1cad3a/redis/src/main/scala/com/typesafe/play/redis/RedisCacheApi.scala#L88 .
Redis Plugin supports String and Serializable, so there is a possibility of accepting null value as set
parameter.
https://github.com/pac4j/play-pac4j/issues/90 also refers to this problem.
Is this going to be addressed? It is quite a pain to check for nulls or NPEs when offering REDIS cache support.
The solution to this issue could be as simple as using String.valueOf(value)
instead of value.toString
, right? I'm in no way an expert, but this should be similar in Scala.