summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHockla, Ali (ah999m) <ah999m@att.com>2017-10-25 12:03:48 -0500
committerHockla, Ali (ah999m) <ah999m@att.com>2017-10-25 12:04:32 -0500
commit78287ab8b72352a91e6626c3f95fecc32b7b54a3 (patch)
tree5ed54f371c2abcd4ec60d2ce95f220be14d28406
parent7e3ace91847ec5aaccfeeff638a8d2d9b17e45fc (diff)
Fix sonar blocker for SOManager
Issue-ID: POLICY-385 Change-Id: I142877a3173a028738b1aa2aea9521f6208bab38 Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
index 93c3f4c57..c6d0994ad 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
@@ -162,21 +162,24 @@ public final class SOManager {
.setPrettyPrinting()
.create();
- String msoJson = gsonPretty.toJson(request);
+ String soJson = gsonPretty.toJson(request);
- SOResponse mso = new SOResponse();
- netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), msoJson);
- Pair<Integer, String> httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", msoJson);
- netLogger.info("[IN|{}|{}|]{}{}", url, "SO", System.lineSeparator(), httpResponse.b);
+ SOResponse so = new SOResponse();
+ netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), soJson);
+ Pair<Integer, String> httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", soJson);
if (httpResponse != null) {
+ netLogger.info("[IN|{}|{}|]{}{}", url, "SO", System.lineSeparator(), httpResponse.b);
+
Gson gson = new Gson();
- mso = gson.fromJson(httpResponse.b, SOResponse.class);
- mso.httpResponseCode = httpResponse.a;
+ so = gson.fromJson(httpResponse.b, SOResponse.class);
+ so.httpResponseCode = httpResponse.a;
+ } else {
+ logger.error("SO Response returned null.");
}
- wm.insert(mso);
- logger.info("SOResponse inserted " + gsonPretty.toJson(mso));
+ wm.insert(so);
+ logger.info("SOResponse inserted " + gsonPretty.toJson(so));
}
});
}