X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2FLogServlet.java;h=101c9e6fc4c5e3647a4079a12b22328a9dcf1eeb;hb=7272b810308f5a6ee402c4546154b6d61f565057;hp=8614a6e838853df119b3dc5fdabe6bd5792f46f2;hpb=9f958d97f639fcafcbc3924a9dd2a666f1b55310;p=dmaap%2Fdatarouter.git 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 {