Sonar major issues 83/61483/1
authorSurendra Reddy Katam <SK00524980@techmahindra.com>
Tue, 21 Aug 2018 06:51:48 +0000 (12:21 +0530)
committerSurendra Reddy Katam <SK00524980@techmahindra.com>
Tue, 21 Aug 2018 06:51:48 +0000 (12:21 +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-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 <SK00524980@techmahindra.com>
src/main/java/com/att/nsa/mr/test/clients/SimpleExamplePublisher.java

index 01e770e..8a6c586 100644 (file)
@@ -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<message> stuck = pub.close ( 20, TimeUnit.SECONDS );
-               if ( stuck.size () > 0 )
+               if ( stuck.isEmpty() )
                {
                        System.err.println ( stuck.size() + " messages unsent" );
                }