summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src
diff options
context:
space:
mode:
authorAmaresh Kumar <kamaresh@in.ibm.com>2018-08-28 20:08:48 +0530
committerAmaresh Kumar <kamaresh@in.ibm.com>2018-08-28 20:16:51 +0530
commit7272b810308f5a6ee402c4546154b6d61f565057 (patch)
treedfed55f58d5dc14fd9913f0c127d411adeda88d0 /datarouter-prov/src
parent9f958d97f639fcafcbc3924a9dd2a666f1b55310 (diff)
Fixed Critical Sonar Issues in LogServlet.java
https://sonar.onap.org/project/issues?fileUuids=AWHFaQitEU5FCDfKtnEp&id=org.onap.dmaap.datarouter%3Aparent&resolved=false&severities=BLOCKER Issue-ID: DMAAP-668 Change-Id: I2d3990c446eabbfdf2a338ad109775a2f7aa0c1b Signed-off-by: Amaresh Kumar <kamaresh@in.ibm.com>
Diffstat (limited to 'datarouter-prov/src')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
index 8614a6e8..101c9e6f 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
@@ -417,13 +417,13 @@ public class LogServlet extends BaseServlet {
Connection conn = null;
try {
conn = db.getConnection();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery(sql);
- while (rs.next()) {
- rh.handleRow(rs);
- }
- rs.close();
- stmt.close();
+ try( Statement stmt = conn.createStatement()){
+ try(ResultSet rs = stmt.executeQuery(sql)){
+ while (rs.next()) {
+ rh.handleRow(rs);
+ }
+ }
+ }
} catch (SQLException sqlException) {
intlogger.info("Failed to get Records. Exception = " +sqlException.getMessage(),sqlException);
} finally {