summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-10-25 17:23:25 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-25 17:23:25 +0000
commit301a15cc38493f1166075ec80f1c88de5abd0373 (patch)
treef741230320e7beebabc64b037ab221bed4edf061
parent85b1ada7cc0883aa8b86ea6e11bf86719e1cc10e (diff)
parent78287ab8b72352a91e6626c3f95fecc32b7b54a3 (diff)
Merge "Fix sonar blocker for SOManager"
-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));
}
});
}