Fix critical issues in dcaegen2-collectors-ves 04/73004/1
authorParshad Patel <pars.patel@samsung.com>
Mon, 19 Nov 2018 07:42:49 +0000 (16:42 +0900)
committerParshad Patel <pars.patel@samsung.com>
Mon, 19 Nov 2018 07:46:48 +0000 (16:46 +0900)
Fix issue related to InterruptedException and equals comparisons between unrelated types

Issue-ID: DCAEGEN2-938
Change-Id: Iaef089dfd889053737fa53616064f1a6ef3a929e
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
src/main/java/org/onap/dcae/commonFunction/ConfigProcessors.java
src/main/java/org/onap/dcae/commonFunction/event/publishing/DMaaPPublishersCache.java

index a9d6b98..09ceeac 100644 (file)
@@ -166,7 +166,7 @@ public class ConfigProcessors {
         if (filter == null || isFilterMet(filter)) {
 
             final JSONObject oldValue = (JSONObject) getEventObjectVal(oldField);
-            if (!oldValue.equals(OBJECT_NOT_FOUND)) {
+            if (!oldValue.toString().equals(OBJECT_NOT_FOUND)) {
                 setEventObjectVal(field, oldValue);
                 removeEventKey(oldField);
             }
@@ -293,7 +293,7 @@ public class ConfigProcessors {
             JSONObject tempJObj = null;
             String tempName = "";
             String tempValue = "";
-            if (!arrayValue.equals(OBJECT_NOT_FOUND)) {
+            if (!arrayValue.toString().equals(OBJECT_NOT_FOUND)) {
                 log.info("old value ==" + arrayValue.toString());
                 // Loop thru the JSONArray, get the name:value pair and write to new JSONObject as hashmap elements
                 for (int i = 0; i < arrayValue.length(); i++) {
@@ -301,7 +301,7 @@ public class ConfigProcessors {
                        tempJObj = arrayValue.getJSONObject(i);
                     if (tempJObj != null) {
                         tempName = tempJObj.get("name").toString();
-                        tempValue = tempJObj.get("value").toString();
+                        tempValue = tempJObj.get(VALUE).toString();
                         newHashMap.put(tempName, tempValue);
                     }
                 }
index 4cdf92d..c66cee0 100644 (file)
@@ -99,6 +99,7 @@ class DMaaPPublishersCache {
                     }
                 } catch (InterruptedException | IOException e) {
                     log.error("Could not close Cambria publisher, some messages might have been dropped", e);
+                    Thread.currentThread().interrupt();
                 }
             }
         }