Sonar major issues 97/60197/1
authorSurendra Reddy Katam <SK00524980@techmahindra.com>
Mon, 13 Aug 2018 05:52:11 +0000 (11:22 +0530)
committerSurendra Reddy Katam <SK00524980@techmahindra.com>
Mon, 13 Aug 2018 05:52:11 +0000 (11:22 +0530)
 Use isEmpty() to check whether the collection is empty or not

Sonar Link:
https://sonar.onap.org/project/issues?assignees=surendraReddy&id=org.onap.dmaap.messagerouter.dmaapclient%3AdmaapClient&open=AV4-MbRu32hFUzlqc5eg&resolved=false&severities=MAJOR
Location:
src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
Line No-180

Change-Id: I7f191d42a87ba5e70005ad282d3d8bbda71998f4
Issue-ID: DMAAP-584
Signed-off-by: Surendra Reddy Katam <SK00524980@techmahindra.com>
src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java

index 5bb5087..991c0e4 100644 (file)
@@ -177,7 +177,7 @@ public class MRSimplerBatchPublisher extends MRBaseClient implements MRBatchingP
        public void close() {
                try {
                        final List<message> remains = close(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
-                       if (remains.size() > 0) {
+                       if (remains.isEmpty()) {
                                getLog().warn("Closing publisher with " + remains.size() + " messages unsent. "
                                                + "Consider using MRBatchingPublisher.close( long timeout, TimeUnit timeoutUnits ) to recapture unsent messages on close.");
                        }