Browse Source

redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value

xushili 1 năm trước cách đây
mục cha
commit
7a0c2f3cc3

+ 12 - 2
redisread/src/main/java/com/gyee/redisread/task/TaskRedisRead.java

@@ -57,7 +57,12 @@ public class TaskRedisRead implements Runnable {
 
             if ("bool".equals(dataType)) {
                 for (int i = 0; i < objects.size(); i++) {
-                    response = (List<String>) objects.get(i);
+                    try {
+                        response = (List<String>) objects.get(i);
+                    }catch (Exception e){
+                        log.error(objects.get(i).toString());
+                        continue;
+                    }
 
                     value = response.get(1);
                     if (value == null || "".equals(value) || value.contains("-nan")) continue;
@@ -89,7 +94,12 @@ public class TaskRedisRead implements Runnable {
                 }
             } else {
                 for (int i = 0; i < objects.size(); i++) {
-                    response = (List<String>) objects.get(i);
+                    try {
+                        response = (List<String>) objects.get(i);
+                    }catch (Exception e){
+                        log.error(objects.get(i).toString());
+                        continue;
+                    }
 
                     value = response.get(1);
                     if (value == null || "".equals(value) || value.contains("-nan")) continue;