Browse Source

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

xushili 1 year ago
parent
commit
7a0c2f3cc3
1 changed files with 12 additions and 2 deletions
  1. 12 2
      redisread/src/main/java/com/gyee/redisread/task/TaskRedisRead.java

+ 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;