summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'holmes-actions/src/main/java/org')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java10
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java2
2 files changed, 10 insertions, 2 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
index 48e6ec0..b3005d5 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
@@ -14,6 +14,7 @@
package org.onap.holmes.common.aai;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
@@ -65,7 +66,11 @@ public class AaiQuery {
private String getVmResourceLinks(String vserverId, String vserverName) throws CorrelationException {
String response = getResourceLinksResponse(vserverId, vserverName);
- return aaiResponseUtil.convertJsonToVmResourceLink(response).get(0).getResourceLink();
+ List linkList = aaiResponseUtil.convertJsonToVmResourceLink(response);
+ if (linkList.size() != 0) {
+ return aaiResponseUtil.convertJsonToVmResourceLink(response).get(0).getResourceLink();
+ }
+ return "";
}
private String getResourceLinksResponse(String vserverId, String vserverName) throws CorrelationException {
@@ -108,6 +113,9 @@ public class AaiQuery {
}
private String getMsbSuffixAddr(String suffixUrl) {
+ if (suffixUrl.length() <= 0) {
+ return "";
+ }
String[] addrSplits = suffixUrl.substring(1).split("/");
String[] conv = addrSplits[2].split("-");
addrSplits[2] = conv[0];
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
index a8d3c0d..748dde0 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
@@ -41,7 +41,7 @@ public class AaiResponseUtil {
List<VmResourceLink> vmResourceLinkList = new ArrayList<>();
String resultDataKey = "result-data";
JSONObject jsonNode = JSON.parseObject(responseJson);
- if (jsonNode.get(resultDataKey) != null) {
+ if (jsonNode != null && jsonNode.get(resultDataKey) != null) {
JSONArray resultData = jsonNode.getJSONArray(resultDataKey);
vmResourceLinkList = convertResultDataList(resultData);
}