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>
Connection conn = null;\r
try {\r
conn = db.getConnection();\r
Connection conn = null;\r
try {\r
conn = db.getConnection();\r
- Statement stmt = conn.createStatement();\r
- ResultSet rs = stmt.executeQuery(sql);\r
- while (rs.next()) {\r
- rh.handleRow(rs);\r
- }\r
- rs.close();\r
- stmt.close();\r
+ try( Statement stmt = conn.createStatement()){\r
+ try(ResultSet rs = stmt.executeQuery(sql)){\r
+ while (rs.next()) {\r
+ rh.handleRow(rs);\r
+ }\r
+ }\r
+ }\r
} catch (SQLException sqlException) {\r
intlogger.info("Failed to get Records. Exception = " +sqlException.getMessage(),sqlException);\r
} finally {\r
} catch (SQLException sqlException) {\r
intlogger.info("Failed to get Records. Exception = " +sqlException.getMessage(),sqlException);\r
} finally {\r