diff options
author | Ram Koya <rk541m@att.com> | 2018-08-29 13:54:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-29 13:54:57 +0000 |
commit | 8a27631d961de4dfcace31a0107a701b735f6959 (patch) | |
tree | 4cbaea418bfd4182239b3a009dab52aa7dac4ae6 /datarouter-prov/src/main/java/org/onap | |
parent | 73663e92fc9db1ce1930553d0d96672b020275ae (diff) | |
parent | 7272b810308f5a6ee402c4546154b6d61f565057 (diff) |
Merge "Fixed Critical Sonar Issues in LogServlet.java"
Diffstat (limited to 'datarouter-prov/src/main/java/org/onap')
-rw-r--r-- | datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java | 14 |
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 {
|