aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-14 09:11:14 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-09-14 09:20:22 -0400
commite9e7bef3c130f7525a5ad250f365ee910bebe85a (patch)
tree54539fe2233e419a07c3d33ce667841c97c9506b /POLICY-SDK-APP/src
parent2ec4d9996e8185f83d6095dfaaa905442b5614b7 (diff)
Fix sonar blocker to close handle
Upgraded the dependency also. What was strange was the documentation that came up did not match with the existing dependency code implementation. Issue-ID: POLICY-113 Change-Id: Ide7830851cda6535ed335e89cdfc0e0a3964e3eb Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'POLICY-SDK-APP/src')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
index a814b0df6..0f55ba6ec 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
@@ -57,6 +57,7 @@ import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
+import javax.json.JsonReader;
import javax.json.JsonValue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -72,6 +73,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.controller.PolicyController;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
@@ -96,7 +98,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.gson.Gson;
@@ -273,10 +274,12 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
final JsonNode value = field.getValue();
if("content".equalsIgnoreCase(key)){
String contentStr = value.toString();
- JsonObject jsonContent = Json.createReader(new StringReader(contentStr)).readObject();
- removed = removeNull(jsonContent);
- if(!jsonContent.toString().equals(removed.toString())){
- contentChanged = true;
+ try (JsonReader jsonReader = Json.createReader(new StringReader(contentStr))) {
+ JsonObject jsonContent = jsonReader.readObject();
+ removed = removeNull(jsonContent);
+ if(!jsonContent.toString().equals(removed.toString())){
+ contentChanged = true;
+ }
}
}
if (value==null || value.isNull()){