fix newest sonar bugs 00/86800/2
authork.kazak <k.kazak@samsung.com>
Thu, 2 May 2019 09:58:21 +0000 (11:58 +0200)
committerKatsia Kazak <k.kazak@samsung.com>
Tue, 7 May 2019 10:34:05 +0000 (10:34 +0000)
OperationProgressor: restore interrupted state
PnfEventReadyDmaapClient: remove useless check for null that never happens
Test for this case already exists in
PnfEventReadyDmaapClientTest.pnfCorrelationIdIsNotFoundInHttpResponse

Change-Id: Ic7e4d0cb701721ee4d9a8bc46d65dc1d847d7704
Issue-ID: SO-1811
Signed-off-by: k.kazak <k.kazak@samsung.com>
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java

index 9f8a456..357b571 100644 (file)
@@ -135,7 +135,8 @@ 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"));
                 }
index 1e31ab2..218cc2d 100644 (file)
@@ -107,6 +107,8 @@ public abstract class OperationProgressor implements Runnable {
             Thread.sleep(milliSeconds);
         } catch (final InterruptedException e) {
             operation.setOperationState(InlineResponse200.OperationStateEnum.FAILED);
+            // Restore interrupted state
+            Thread.currentThread().interrupt();
         }
     }