diff options
3 files changed, 17 insertions, 3 deletions
diff --git a/holmes-actions/pom.xml b/holmes-actions/pom.xml index b13870a..7551cda 100644 --- a/holmes-actions/pom.xml +++ b/holmes-actions/pom.xml @@ -104,6 +104,12 @@ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
@@ -172,7 +178,7 @@ <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.8.3</version>
+ <version>1.9.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
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); } |