From cf1d4c5a274ecddf6098ed813806831d34a3488b Mon Sep 17 00:00:00 2001 From: shashikanth Date: Mon, 25 Sep 2017 19:47:04 +0530 Subject: [PATCH] Fixed string literal comparision redundant code Move the "content" string literal on the left side of this string comparison. Issue-Id:SO-118 Change-Id: Ice9ef2d94f594669f0399d31e5346e3c0be66c13 Signed-off-by: shashikanth.vh --- .../main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index d5170af22d..d0de819e03 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -156,7 +156,7 @@ public class JsonUtils { str = null; } // append the content to the XML output - if (key.equals("content")) { + if ("content".equals(key)) { if (curObj instanceof JSONArray) { jsonArr = (JSONArray) curObj; len = jsonArr.length(); @@ -952,11 +952,9 @@ public class JsonUtils { try { Object rawValue = getJsonRawValue(jsonStr, keys); - if (rawValue == null) { - return false; - } else { - return true; - } + + return !(rawValue == null); + } catch (Exception e) { msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e); } -- 2.16.6