aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {