when a script returns Null value, jedis throws NullPointerException

This commit is contained in:
Jonathan Leibiusky
2013-02-05 15:44:35 -03:00
parent 23e50a363e
commit 9d538a06fd
2 changed files with 120 additions and 104 deletions

View File

@@ -2768,15 +2768,17 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
private Object getEvalResult() {
Object result = client.getOne();
if (result instanceof byte[])
return SafeEncoder.encode((byte[]) result);
if (result instanceof List<?>) {
List<?> list = (List<?>) result;
List<String> listResult = new ArrayList<String>(list.size());
for (Object bin : list)
listResult.add(SafeEncoder.encode((byte[]) bin));
for (Object bin : list) {
listResult.add((bin == null ? null : SafeEncoder
.encode((byte[]) bin)));
}
return listResult;
}