Sonar major issues 19/61519/1
authorSurendra Reddy Katam <SK00524980@techmahindra.com>
Tue, 21 Aug 2018 09:28:19 +0000 (14:58 +0530)
committerSurendra Reddy Katam <SK00524980@techmahindra.com>
Tue, 21 Aug 2018 09:28:19 +0000 (14:58 +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-MbTf32hFUzlqc5gL&resolved=false&severities=MAJOR
Location:
src/main/java/com/att/nsa/mr/test/clients/SamplePublisher.java
Line No- L77 L45

Change-Id: I240d7411f80a644b119f28271bf9ee13298f770f
Issue-ID: DMAAP-620
Signed-off-by: Surendra Reddy Katam <SK00524980@techmahindra.com>
src/main/java/com/att/nsa/mr/test/clients/SamplePublisher.java

index 36c2b7f..0233dcb 100644 (file)
@@ -42,7 +42,7 @@ public class SamplePublisher {
                final String hosts = ( args.length > 0 ? args[0] : "localhost:8181" );
 
                // read the topic name from the command line
-               //final String topic = ( args.length > 1 ? args[1] : "MY-EXAMPLE-TOPIC" );
+               
                final String topic = ( args.length > 1 ? args[1] : "com.att.app.dmaap.mr.testingTopic" );
 
                // set up some batch limits and the compression flag
@@ -74,7 +74,7 @@ public class SamplePublisher {
                // 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())
                {
                        LOG.warn ( stuck.size() + " messages unsent" );
                }