aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-09-03 15:36:13 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-09-03 15:36:29 +0530
commit9e44b46b5fbb760b7b43fb515041512678aa977b (patch)
tree8d065934a59964ad18a57f5afb6d9e531d9d5f78 /src/main
parent8b80c9a3005862032908478570f9c500bf0d9fb5 (diff)
ConnWrapper.java: Fixed sonar issue
Fixed sonar code-smells/issues accross this file. Issue-ID: DMAAP-707 Change-Id: Ib7ffeb3d8b1023c739282d9069df946949f63a7d Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/ConnWrapper.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/ConnWrapper.java b/src/main/java/org/onap/dmaap/dbcapi/database/ConnWrapper.java
index e0c7819..2317fe4 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/ConnWrapper.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/ConnWrapper.java
@@ -22,17 +22,22 @@ package org.onap.dmaap.dbcapi.database;
import java.sql.*;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
public abstract class ConnWrapper<T, U> {
+ EELFLogger logger = EELFManager.getInstance().getLogger( ConnWrapper.class );
protected Connection c;
protected PreparedStatement ps;
protected ResultSet rs;
protected abstract T run(U u) throws Exception;
- public T protect(ConnectionFactory cf, U u) throws DBException {
+ public T protect(ConnectionFactory cf, U u) {
try {
try {
return(attempt(cf, u, false));
} catch (SQLException sqle) {
+ logger.error("Error", sqle);
return(attempt(cf, u, true));
}
} catch (RuntimeException rte) {
@@ -52,11 +57,26 @@ public abstract class ConnWrapper<T, U> {
c = null;
return(ret);
} finally {
- if (rs != null) { try { rs.close(); } catch (Exception e) {}}
+ if (rs != null) {
+ try {
+ rs.close();
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }}
rs = null;
- if (ps != null) { try { ps.close(); } catch (Exception e) {}}
+ if (ps != null) {
+ try {
+ ps.close();
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }}
ps = null;
- if (c != null) { try { c.close(); } catch (Exception e) {}}
+ if (c != null) {
+ try {
+ c.close();
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }}
c = null;
}
}