From 962e97959cfe711da4222dcb0e3cb3abebfc3d74 Mon Sep 17 00:00:00 2001
From: Sumapriya Sarvepalli <ss00493505@techmahindra.com>
Date: Thu, 23 Aug 2018 17:25:27 +0530
Subject: Sonar Major issues

 Use isEmpty to check whether the collection is empty or not
Sonar Link:
https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-Vagz32hFUzlqc5s-&resolved=false&severities=MAJOR
Location:
src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
Line No:L189 L254 L276

Change-Id: I272279d7db44611b8339f166dcd5884ead4da1b0
Issue-ID: DMAAP-634
Signed-off-by: Sumapriya Sarvepalli <ss00493505@techmahindra.com>
---
 .../metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java b/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
index d8d8799..5b937c2 100644
--- a/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
+++ b/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
@@ -186,7 +186,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
 	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 CambriaBatchingPublisher.close( long timeout, TimeUnit timeoutUnits ) to recapture unsent messages on close.");
 			}
@@ -251,7 +251,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
 	 */
 	private synchronized boolean shouldSendNow() {
 		boolean shouldSend = false;
-		if (fPending.size() > 0) {
+		if (fPending.isEmpty()) {
 			final long nowMs = Clock.now();
 
 			shouldSend = (fPending.size() >= fMaxBatchSize);
@@ -273,7 +273,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
 	private synchronized boolean sendBatch() {
 		// it's possible for this call to be made with an empty list. in this
 		// case, just return.
-		if (fPending.size() < 1) {
+		if (fPending.isEmpty()) {
 			return true;
 		}
 
-- 
cgit 1.2.3-korg