修复域名查询bright cloud时cats信息为空报错

This commit is contained in:
zhanghongqing
2023-05-08 14:52:09 +08:00
parent d6d507b3b6
commit b9ae09c7d6

View File

@@ -106,10 +106,15 @@ public class BrightCloud {
// json处理 // json处理
JSONObject queries = jo.getJSONObject("queries"); JSONObject queries = jo.getJSONObject("queries");
JSONObject getInfo = queries.getJSONObject(bcConfig.getQueryType()); JSONObject getInfo = queries.getJSONObject(bcConfig.getQueryType());
JSONObject cat = getInfo.getJSONArray("cats").getJSONObject(0);
Integer catId = cat.getInteger("catid");
String fqdn = jo.getString("url"); String fqdn = jo.getString("url");
int catId = 0;
int catConf = 0;
if (getInfo.getJSONArray("cats") != null && getInfo.getJSONArray("cats").size() > 0) {
JSONObject cat = getInfo.getJSONArray("cats").getJSONObject(0);
catId = cat.getInteger("catid");
catConf = cat.getInteger("conf");
}
domainFiles.add(new DomainCategory( domainFiles.add(new DomainCategory(
fqdn, fqdn,
"brightcloud", "brightcloud",
@@ -120,8 +125,9 @@ public class BrightCloud {
catId, catId,
getCatInfo(catId).get(0), getCatInfo(catId).get(0),
getCatInfo(catId).get(1), getCatInfo(catId).get(1),
cat.getInteger("conf"), catConf,
getInfo.getBoolean("a1cat"))); getInfo.getBoolean("a1cat")));
} }
} }
return domainFiles; return domainFiles;