Merge "Sonar majior issues"
authorsunil unnava <su622b@att.com>
Mon, 11 Feb 2019 14:12:16 +0000 (14:12 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 11 Feb 2019 14:12:16 +0000 (14:12 +0000)
src/main/java/org/onap/dmaap/mr/client/MRClientBuilders.java
src/main/java/org/onap/dmaap/mr/client/impl/MRBaseClient.java
src/main/java/org/onap/dmaap/mr/client/impl/MRConstants.java
src/main/java/org/onap/dmaap/mr/client/impl/MRConsumerImpl.java
src/main/java/org/onap/dmaap/mr/client/impl/MRMetaClient.java
src/main/java/org/onap/dmaap/mr/test/clients/SimpleExampleConsumer.java

index 60e0666..abf3736 100644 (file)
@@ -149,7 +149,7 @@ public class MRClientBuilders
          */
         public MRConsumer build ()
         {
-            if ( fHosts == null || fHosts.size() == 0 || fTopic == null )
+            if ( fHosts == null || fHosts.isEmpty() || fTopic == null )
             {
                 throw new IllegalArgumentException ( "You must provide at least one host and a topic name." );
             }
@@ -208,7 +208,7 @@ public class MRClientBuilders
          */
         public PublisherBuilder usingHosts ( String[] hostSet )
         {
-            final TreeSet<String> hosts = new TreeSet<String> ();
+            final TreeSet<String> hosts = new TreeSet<> ();
             for ( String hp : hostSet )
             {
                 hosts.add ( hp );
index ecea21c..8ed7dd8 100644 (file)
@@ -75,7 +75,7 @@ public class MRBaseClient extends HttpClient implements MRClient {
                if (a == null)
                        return null;
 
-               final TreeSet<String> set = new TreeSet<String>();
+               final TreeSet<String> set = new TreeSet<>();
                for (int i = 0; i < a.length(); i++) {
                        set.add(a.getString(i));
                }
index f6d9578..5ed44c6 100644 (file)
@@ -110,7 +110,7 @@ class MRConstants
         */
        public static List<HttpHost> createHostsList(Collection<String> hosts)
        {
-               final ArrayList<HttpHost> convertedHosts = new ArrayList<HttpHost> ();
+               final ArrayList<HttpHost> convertedHosts = new ArrayList<> ();
                for ( String host : hosts )
                {
                        if ( host.length () == 0 ) continue;
index a1a52aa..d224bdf 100644 (file)
@@ -241,7 +241,7 @@ public class MRConsumerImpl extends MRBaseClient implements MRConsumer {
 
     @Override
     public MRConsumerResponse fetchWithReturnConsumerResponse(int timeoutMs, int limit) {
-        final LinkedList<String> msgs = new LinkedList<String>();
+        final LinkedList<String> msgs = new LinkedList<>();
         MRConsumerResponse mrConsumerResponse = new MRConsumerResponse();
         try {
             if (ProtocolTypeConstants.DME2.getValue().equalsIgnoreCase(protocolFlag)) {
index 9051b99..04b26d5 100644 (file)
@@ -51,7 +51,7 @@ public class MRMetaClient extends MRBaseClient implements MRTopicManager, MRIden
        @Override
        public Set<String> getTopics () throws IOException
        {
-               final TreeSet<String> set = new TreeSet<String> ();
+               final TreeSet<String> set = new TreeSet<> ();
                try
                {
                        final JSONObject topicSet = get ( "/topics" );
index a7f283c..a5c0c3a 100644 (file)
@@ -62,7 +62,7 @@ public class SimpleExampleConsumer {
                                Thread.sleep(2);
                                i++;
                                for (String msg : cc.fetch()) {
-                                       // System.out.println ( "" + (++count) + ": " + msg );
+                               
                                        System.out.println(msg);
                                }