summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwanglihui <[email protected]>2021-11-05 19:01:12 +0800
committerwanglihui <[email protected]>2021-11-05 19:01:12 +0800
commitcc3f0cf62026169876bdff26b786fffb4a5f3cf3 (patch)
tree611afb825894c47b9fe6f09e248c546b5e3485d0
parent0617b1e61452878c9edef44443291296ddbada69 (diff)
解决获取配置为空时空指针异常bug。
-rw-r--r--src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java b/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java
index 49f4fea..77ff8e9 100644
--- a/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java
+++ b/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java
@@ -123,8 +123,13 @@ public class ParseStaticThreshold {
String msg = resposeMap.get("msg").toString();
if (success) {
HashMap<String, Object> data = jsonMapperInstance.fromJson(jsonMapperInstance.toJson(resposeMap.get("data")), hashmapJsonType);
- thresholds = jsonMapperInstance.fromJson(jsonMapperInstance.toJson(data.get("list")), thresholdType);
- logger.info("获取到静态阈值配置{}条", thresholds.size());
+ Object list = data.get("list");
+ if (list != null) {
+ thresholds = jsonMapperInstance.fromJson(jsonMapperInstance.toJson(list), thresholdType);
+ logger.info("获取到静态阈值配置{}条", thresholds.size());
+ } else {
+ logger.warn("静态阈值配置为空");
+ }
} else {
logger.error(msg);
}
@@ -181,7 +186,7 @@ public class ParseStaticThreshold {
}
}
}
- thresholdRangeMap.put(attackType,treeRangeMap);
+ thresholdRangeMap.put(attackType, treeRangeMap);
}
}
} catch (Exception e) {