play-plugins icon indicating copy to clipboard operation
play-plugins copied to clipboard

Redis Plugin: NullpointerException when setting null

Open ide-an opened this issue 8 years ago • 1 comments

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.

ide-an avatar Sep 19 '16 15:09 ide-an

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.

resamsel avatar May 26 '17 20:05 resamsel