fixed code smells 51/104851/1
authorRupinder <rupinsi1@in.ibm.com>
Wed, 1 Apr 2020 11:51:21 +0000 (17:21 +0530)
committerRupinder <rupinsi1@in.ibm.com>
Wed, 1 Apr 2020 11:59:01 +0000 (17:29 +0530)
Fixed some of the sonar issues

Issue-ID: DMAAP-1415
Change-Id: I07dbdc3fa6e478f811c28948991e9a32963113d1
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java
src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java
src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java

index 4f072ac..1572835 100644 (file)
@@ -98,7 +98,10 @@ public class CambriaPublisherUtility
                final ArrayList<HttpHost> convertedHosts = new ArrayList<>();
                for ( String host : hosts )
                {
-                       if ( host.length () == 0 ) continue;
+                       if ( host.length () == 0 ){
+                               continue;
+                       }
+                       
                        convertedHosts.add ( hostForString ( host ) );
                }
                return convertedHosts;
@@ -115,13 +118,18 @@ public class CambriaPublisherUtility
         */
        public static HttpHost hostForString ( String host )
        {
-               if ( host.length() < 1 ) throw new IllegalArgumentException ( "An empty host entry is invalid." );
+               if ( host.length() < 1 ){
+                       throw new IllegalArgumentException ( "An empty host entry is invalid." );
+               }
                
                String hostPart = host;
                int port = kStdCambriaServicePort;
 
                final int colon = host.indexOf ( ':' );
-               if ( colon == 0 ) throw new IllegalArgumentException ( "Host entry '" + host + "' is invalid." );
+               if ( colon == 0 ){
+                       throw new IllegalArgumentException ( "Host entry '" + host + "' is invalid." );
+               }
+               
                if ( colon > 0 )
                {
                        hostPart = host.substring ( 0, colon ).trim();
index 6bedd18..050bf29 100644 (file)
@@ -69,8 +69,10 @@ public class CambriaBaseClient extends HttpClient implements org.onap.dmaap.dmf.
 
        public Set<String> jsonArrayToSet ( JSONArray a ) throws JSONException
        {
-               if ( a == null ) return null;
-
+               if ( a == null ){
+                       return null;
+               }
+               
                final TreeSet<String> set = new TreeSet<>();
                for ( int i=0; i<a.length (); i++ )
                {
index 93baee0..1000f15 100644 (file)
@@ -63,8 +63,10 @@ public class CambriaRawStreamReader implements reader
         */
        public message next () throws CambriaApiException
        {
-               if ( fClosed ) return null;
-
+               if ( fClosed ){
+                       return null;
+               }
+               
                try
                {
                        final byte[] rawBytes = StreamTools.readBytes ( fStream );