diff --git a/microservices-modules/microservices-modules-mon/src/main/java/com/microservices/mon/k8s/service/impl/K8SDashboardServiceImpl.java b/microservices-modules/microservices-modules-mon/src/main/java/com/microservices/mon/k8s/service/impl/K8SDashboardServiceImpl.java index 8a3c7636f..e666b7106 100644 --- a/microservices-modules/microservices-modules-mon/src/main/java/com/microservices/mon/k8s/service/impl/K8SDashboardServiceImpl.java +++ b/microservices-modules/microservices-modules-mon/src/main/java/com/microservices/mon/k8s/service/impl/K8SDashboardServiceImpl.java @@ -275,18 +275,20 @@ public class K8SDashboardServiceImpl extends CommonService implements IK8sDashbo case FLOW_CONTROL: // 处理应用流量控制功能相关逻辑 JSONObject sentinelAppList = remoteGatewayService.getSentinelAppList(SecurityContextHolder.getUserKey()); - if (sentinelAppList != null && sentinelAppList.getBoolean("success") && sentinelAppList.getJSONArray("data") != null && !sentinelAppList.getJSONArray("data").isEmpty()) { + if (sentinelAppList != null && sentinelAppList.containsKey("success") && sentinelAppList.getBoolean("success")) { JSONArray sentinelAppListArray = sentinelAppList.getJSONArray("data"); - for (int i = 0; i < sentinelAppListArray.size(); i++) { - JSONObject sentinelApp = sentinelAppListArray.getJSONObject(i); - if (k8sLabelValue.equals(sentinelApp.getString("app"))) { - applicationFunction = new ApplicationFunction(); - applicationFunction.setKeyAndName(applicationFunctionType); - functionVariables = new JSONObject(); - functionVariables.put("app", k8sLabelValue); - functionVariables.put("appType", sentinelApp.getLongValue("appType")); - applicationFunction.setVariables(functionVariables); - applicationFunctionsList.add(applicationFunction); + if (sentinelAppListArray != null && !sentinelAppList.getJSONArray("data").isEmpty()) { + for (int i = 0; i < sentinelAppListArray.size(); i++) { + JSONObject sentinelApp = sentinelAppListArray.getJSONObject(i); + if (k8sLabelValue.equals(sentinelApp.getString("app"))) { + applicationFunction = new ApplicationFunction(); + applicationFunction.setKeyAndName(applicationFunctionType); + functionVariables = new JSONObject(); + functionVariables.put("app", k8sLabelValue); + functionVariables.put("appType", sentinelApp.getLongValue("appType")); + applicationFunction.setVariables(functionVariables); + applicationFunctionsList.add(applicationFunction); + } } } }