From 62d53f52c5535b48bb8f253df39615b6338d822f Mon Sep 17 00:00:00 2001 From: Surendra Reddy Katam Date: Tue, 21 Aug 2018 12:21:48 +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=surendraReddy&id=org.onap.dmaap.messagerouter.dmaapclient%3AdmaapClient&open=AV4-MbT632hFUzlqc5gr&resolved=false&severities=MAJOR Location: src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java Line No- L57 L62 L71 Change-Id: I4ac3ebea88d03147a54676cd5f9c77f274dfd87a Issue-ID: DMAAP-617 Signed-off-by: Surendra Reddy Katam --- .../java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java b/src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java index 01e770e..8a6c586 100644 --- a/src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java +++ b/src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java @@ -54,12 +54,12 @@ public class SimpleExamplePublisher // publish some messages final JSONObject msg1 = new JSONObject (); msg1.put ( "Name", "Sprint" ); - //msg1.put ( "greeting", "Hello .." ); + pub.send ( "First cambria messge" ); pub.send ( "MyPartitionKey", msg1.toString () ); final JSONObject msg2 = new JSONObject (); - //msg2.put ( "mrclient1", System.currentTimeMillis () ); + // ... @@ -68,7 +68,7 @@ public class SimpleExamplePublisher // publisher interface allows the app to get the set of unsent messages. It could // write them to disk, for example, to try to send them later. final List stuck = pub.close ( 20, TimeUnit.SECONDS ); - if ( stuck.size () > 0 ) + if ( stuck.isEmpty() ) { System.err.println ( stuck.size() + " messages unsent" ); } -- cgit 1.2.3-korg