summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle
diff options
context:
space:
mode:
authorJegadeesh Babu <jegabab1@in.ibm.com>2019-02-18 18:56:48 +0530
committerTakamune Cho <takamune.cho@att.com>2019-02-27 01:13:11 +0000
commitb0bc41c4d4595bf661123ba06290daa6d77b1239 (patch)
treea795fd71f617703b99c6655cebff6c6be629cd04 /appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle
parent9b7dbdcd6a120da003a084ce83cc3f482c5c6d5b (diff)
Added Null check
Code to avoid null pointer Exception Issue-ID: APPC-1451 Change-Id: I5e2324a2ddffbc50251ee93a1278cfb68e62a551 Signed-off-by: Jegadeesh Babu <jegabab1@in.ibm.com>
Diffstat (limited to 'appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle')
-rw-r--r--appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
index fafe3deb1..ace39ee9c 100644
--- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
+++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
@@ -6,6 +6,8 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
+ * Modifications Copyright (C) 2019 IBM
+ * =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -476,12 +478,14 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
private AnsibleResult postExecRequest(String agentUrl, String payload, String user, String password,
SvcLogicContext ctx) {
- AnsibleResult testResult;
+ AnsibleResult testResult = null;
ConnectionBuilder httpClient = getHttpConn(defaultSocketTimeout, "");
if (!testMode) {
+ if(httpClient!=null) {
httpClient.setHttpContext(user, password);
testResult = httpClient.post(agentUrl, payload);
httpClient.close();
+ }
} else {
testResult = testServer.Post(agentUrl, payload);
}
@@ -509,9 +513,11 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
logger.info("Querying ansible GetResult URL = " + agentUrl);
if (!testMode) {
+ if(httpClient!=null) {
httpClient.setHttpContext(user, password);
testResult = httpClient.get(agentUrl);
httpClient.close();
+ }
} else {
testResult = testServer.Get(agentUrl);
}