修复域名查询bright cloud时cats信息为空报错
This commit is contained in:
@@ -27,7 +27,7 @@ public class BrightCloud {
|
||||
private final HashMap<Integer, List<String>> catId2Info = new HashMap<>();
|
||||
private HttpURLConnection con;
|
||||
|
||||
private static BrightCloudConfig bcConfig = (BrightCloudConfig) SpringContextUtil.getBean("brightCloudConfig");
|
||||
private static BrightCloudConfig bcConfig = (BrightCloudConfig) SpringContextUtil.getBean("brightCloudConfig");
|
||||
|
||||
public List<DomainCategory> getBrightCloudDomainCategory(List<String> domains) {
|
||||
JSONObject queryResults = getQueryResults(domains);
|
||||
@@ -106,10 +106,15 @@ public class BrightCloud {
|
||||
// json处理
|
||||
JSONObject queries = jo.getJSONObject("queries");
|
||||
JSONObject getInfo = queries.getJSONObject(bcConfig.getQueryType());
|
||||
|
||||
JSONObject cat = getInfo.getJSONArray("cats").getJSONObject(0);
|
||||
Integer catId = cat.getInteger("catid");
|
||||
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(
|
||||
fqdn,
|
||||
"brightcloud",
|
||||
@@ -120,8 +125,9 @@ public class BrightCloud {
|
||||
catId,
|
||||
getCatInfo(catId).get(0),
|
||||
getCatInfo(catId).get(1),
|
||||
cat.getInteger("conf"),
|
||||
catConf,
|
||||
getInfo.getBoolean("a1cat")));
|
||||
|
||||
}
|
||||
}
|
||||
return domainFiles;
|
||||
|
||||
Reference in New Issue
Block a user