aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorRam Koya <rk541m@att.com>2018-09-13 15:05:05 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-13 15:05:05 +0000
commitc7c119189df193e8af2bd025a971dcedf719ddb5 (patch)
treedf5ccb9c7cbc69789c94c9a4c02a4bc1f22e7c0c /src/main/java/org
parentfc598939117f10575a91ffeb64faaa6d90c5a4d5 (diff)
parentfef426178745a5d00963d7fb32696744953a4d07 (diff)
Merge "LoadSchema.java: Fixed sonar issue"
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/LoadSchema.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/LoadSchema.java b/src/main/java/org/onap/dmaap/dbcapi/database/LoadSchema.java
index 2c52b0d..1f1b078 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/LoadSchema.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/LoadSchema.java
@@ -23,20 +23,12 @@ package org.onap.dmaap.dbcapi.database;
import java.io.*;
import java.sql.*;
-import org.apache.log4j.Logger;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-
-import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
+;
public class LoadSchema {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(LoadSchema.class);
- private static final EELFLogger appLogger = EELFManager.getInstance().getApplicationLogger();
- private static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private static final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
- private static final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
- private static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
static int getVer(Statement s) throws SQLException {
ResultSet rs = null;
@@ -66,6 +58,7 @@ public class LoadSchema {
stmt.execute(cmd);
logger.info("SCHEMA: " + cmd);
} catch (SQLException sqle) {
+ logger.error("Error", sqle);
throw sqle;
}
@@ -74,7 +67,9 @@ public class LoadSchema {
int newver = -1;
try {
newver = getVer(stmt);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }
logger.info("Database schema currently at version " + newver++);
@@ -126,8 +121,20 @@ public class LoadSchema {
} catch (IOException ioe) {
throw new SQLException(ioe);
} finally {
- if (stmt != null) { try { stmt.close(); } catch (Exception e) {}}
- if (c != null) { try { c.close(); } catch (Exception e) {}}
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }
+ }
+ if (c != null) {
+ try {
+ c.close();
+ } catch (Exception e) {
+ logger.error("Error", e);
+ }
+ }
}
}
public static void main(String[] args) throws Exception {