Merge "add junit coverage for SvnfmService"
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / java / org / onap / so / bpmn / infrastructure / pnf / dmaap / PnfEventReadyDmaapClient.java
index cce476f..48061db 100644 (file)
@@ -90,7 +90,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
     @Override
     public synchronized Runnable unregister(String pnfCorrelationId) {
         logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
-        Runnable runnable = runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
+        Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
         synchronized (updateInfoMap) {
             for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
                 if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
@@ -135,12 +135,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
                 HttpResponse response = httpClient.execute(getRequest);
                 List<String> idList = getPnfCorrelationIdListFromResponse(response);
 
-                if (idList != null && idList.size() > 0) {
+                // idList is never null
+                if (!idList.isEmpty()) {
                     // send only body of response
                     registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
                 }
 
-                idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+                if (idList != null) {
+                    idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+                }
             } catch (IOException e) {
                 logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
             } finally {