summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-04-01 17:21:21 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-04-01 17:29:01 +0530
commit78c361428d27096e376547afba565222d1715a96 (patch)
treeaab6d470ec2f54cb67f97288179507267705c5e4 /src/main/java/org
parent59a60f43fe558951089be159c1111a5231defe57 (diff)
fixed code smells
Fixed some of the sonar issues Issue-ID: DMAAP-1415 Change-Id: I07dbdc3fa6e478f811c28948991e9a32963113d1 Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java14
-rw-r--r--src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java6
-rw-r--r--src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java6
3 files changed, 19 insertions, 7 deletions
diff --git a/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java b/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java
index 4f072ac..1572835 100644
--- a/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java
+++ b/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/CambriaPublisherUtility.java
@@ -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();
diff --git a/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java b/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java
index 6bedd18..050bf29 100644
--- a/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java
+++ b/src/main/java/org/onap/dmaap/dmf/mr/metrics/publisher/impl/CambriaBaseClient.java
@@ -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++ )
{
diff --git a/src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java b/src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java
index 93baee0..1000f15 100644
--- a/src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java
+++ b/src/main/java/org/onap/dmaap/dmf/mr/resources/streamReaders/CambriaRawStreamReader.java
@@ -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 );