aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDriptaroop Das <driptaroop.das@in.ibm.com>2019-02-06 00:58:56 +0530
committerDriptaroop Das <driptaroop.das@in.ibm.com>2019-02-06 00:59:17 +0530
commit4a75a26ddd9d7192e162cf3dc6a04e8a80fcce06 (patch)
tree796daaf7e4b6e5f5c638aef136abae3511b3b873 /src/main
parent022f4cde96a57fdc6f002e09ae5d9b314e4150e3 (diff)
Multiple Sonar Fixes
Multiple Sonar Fixes Issue-ID: DMAAP-1023 Change-Id: Idcc12fda4678841d9510e744780273be89ced3e1 Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java39
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/Topic.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java4
4 files changed, 16 insertions, 33 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
index a8f075c..441596a 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
@@ -243,19 +243,10 @@ public class DrProvConnection extends BaseLoggingClass {
try {
uc.setRequestMethod("POST");
-// uc.setRequestProperty("Content-Type", feedContenType );
-// uc.setRequestProperty( "charset", "utf-8");
-// uc.setRequestProperty( behalfHeader, postFeed.getOwner() );
-// uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
-// uc.setUseCaches(false);
-// uc.setDoOutput(true);
- OutputStream os = null;
-
-
+
+
try {
uc.connect();
- os = uc.getOutputStream();
-
} catch (ProtocolException pe) {
// Rcvd error instead of 100-Continue
@@ -264,6 +255,7 @@ public class DrProvConnection extends BaseLoggingClass {
// without this, Java will connect multiple times to the server to run the same request
uc.setDoOutput(false);
} catch (Exception e) {
+ logger.error(e.getMessage(), e);
}
}
rc = uc.getResponseCode();
@@ -278,12 +270,14 @@ public class DrProvConnection extends BaseLoggingClass {
err.setMessage(responsemessage);
}
} catch (Exception e) {
- System.err.println("Unable to read response " );
+ logger.error("Unable to read response " );
e.printStackTrace();
} finally {
try {
uc.disconnect();
- } catch ( Exception e ) {}
+ } catch ( Exception e ) {
+ logger.error(e.getMessage(), e);
+ }
}
return rc;
@@ -521,8 +515,8 @@ public class DrProvConnection extends BaseLoggingClass {
err.setCode( 500 );
err.setMessage("Backend connection refused");
} catch (Exception e) {
- System.err.println("Unable to read response " );
- e.printStackTrace();
+ logger.error("Unable to read response " );
+ logger.error(e.getMessage(), e);
} finally {
uc.disconnect();
}
@@ -542,22 +536,13 @@ public class DrProvConnection extends BaseLoggingClass {
logger.info( "templog:doGetNodes at 12.10.14.11" );
uc.setRequestMethod("GET");
-
- //uc.setRequestProperty("Content-Type", subContentType );
- //uc.setRequestProperty( "charset", "utf-8");
- //uc.setRequestProperty( behalfHeader, "DGL" );
- //uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
- //uc.setUseCaches(false);
- //uc.setDoOutput(true);
- OutputStream os = null;
int rc = -1;
logger.info( "templog:doGetNodes at 12.10.14.12" );
try {
- uc.connect();
- logger.info( "templog:doGetNodes at 12.10.14.13" );
- //os = uc.getOutputStream();
- //os.write( postData );
+ uc.connect();
+ logger.info( "templog:doGetNodes at 12.10.14.13" );
+
} catch (ProtocolException pe) {
logger.info( "templog:doGetNodes at 12.10.14.14" );
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
index b404479..e2004bd 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
@@ -149,7 +149,7 @@ public class DatabaseClass extends BaseLoggingClass {
appLogger.warn("Problem updating DB schema", e);
}
try {
- dmaap = new DBSingleton<Dmaap>(Dmaap.class, "dmaap");
+ dmaap = new DBSingleton<>(Dmaap.class, "dmaap");
dcaeLocations = new DBMap<>(DcaeLocation.class, "dcae_location", "dcae_location_name");
dr_nodes = new DBMap<>(DR_Node.class, "dr_node", "fqdn");
dr_pubs = new DBMap<>(DR_Pub.class, "dr_pub", "pub_id");
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
index 7eea5f1..cffe448 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
@@ -128,7 +128,7 @@ public class Topic extends DmaapObject {
public Topic() {
super();
- this.clients = new ArrayList<MR_Client>();
+ this.clients = new ArrayList<>();
this.lastMod = new Date();
this.replicationCase = ReplicationType.Validator("none");
this.setLastMod();
@@ -140,7 +140,6 @@ public class Topic extends DmaapObject {
this.fqtn = fqtn;
this.topicName = topicName;
this.topicDescription = topicDescription;
- //this.dcaeLocationName = dcaeLocationName;
this.tnxEnabled = tnxEnabled;
this.owner = owner;
this.init();
@@ -178,7 +177,6 @@ public class Topic extends DmaapObject {
this.setTopicName( (String) jsonObj.get( "topicName" ) );
this.setTopicDescription( (String) jsonObj.get( "topicDescription" ));
this.setOwner( (String) jsonObj.get( "owner" ) );
- //this.setLastMod();
this.setStatus( (String) jsonObj.get( "status" ) );
this.setReplicationCase( ReplicationType.Validator( (String) jsonObj.get( "replicationCase" ) ));
this.setFqtnStyle( FqtnType.Validator( (String) jsonObj.get( "fqtnStyle" ) ) );
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
index 2fd75d0..99c8f31 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
@@ -65,11 +65,11 @@ public class DR_SubService extends BaseLoggingClass {
public List<DR_Sub> getAllDr_Subs() {
logger.debug( "enter getAllDR_Subs()");
- return new ArrayList<DR_Sub>(dr_subs.values());
+ return new ArrayList<>(dr_subs.values());
}
public ArrayList<DR_Sub> getDr_SubsByFeedId( String pubId ) {
- ArrayList<DR_Sub> someSubs = new ArrayList<DR_Sub>();
+ ArrayList<DR_Sub> someSubs = new ArrayList<>();
for( DR_Sub sub : dr_subs.values() ) {
if ( pubId.equals( sub.getFeedId() )) {
someSubs.add( sub );