Fixed string literal comparision redundant code 99/15099/2
authorshashikanth <shashikanth.vh@huawei.com>
Mon, 25 Sep 2017 14:17:04 +0000 (19:47 +0530)
committerShashikanth VH <shashikanth.vh@huawei.com>
Mon, 25 Sep 2017 14:19:33 +0000 (14:19 +0000)
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 <shashikanth.vh@huawei.com>
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java

index d5170af..d0de819 100644 (file)
@@ -156,7 +156,7 @@ public class JsonUtils {
                                        str = null;\r
                                }\r
                                // append the content to the XML output\r
-                               if (key.equals("content")) {\r
+                               if ("content".equals(key)) {\r
                                        if (curObj instanceof JSONArray) {\r
                                                jsonArr = (JSONArray) curObj;\r
                                                len = jsonArr.length();\r
@@ -952,11 +952,9 @@ public class JsonUtils {
 \r
                try {\r
                        Object rawValue = getJsonRawValue(jsonStr, keys);\r
-                       if (rawValue == null) {\r
-                               return false;\r
-                       } else {\r
-                               return true;\r
-                       }\r
+\r
+                       return !(rawValue == null);\r
+\r
                } catch (Exception e) {\r
                                msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e);\r
                }\r