From 47099b56dcecba622e574b37c0167a061d6f667b Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Tue, 24 Jul 2018 19:15:27 +0900 Subject: Fix sonar issues Fix sonar issues in ccsdk/sli/core Issue-ID: CCSDK-332 Change-Id: I2aee69cf410d8f9cb63f3a22aeb793a99e27d2c7 Signed-off-by: Parshad Patel --- .../main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'dblib/provider') diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java index 97380f58..f3ecfa27 100755 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java @@ -214,10 +214,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito throws SQLException { long time = System.currentTimeMillis(); - CachedRowSet data; - - try (PreparedStatement ps = conn.prepareStatement(statement)) { - data = RowSetProvider.newFactory().createCachedRowSet(); + try (PreparedStatement ps = conn.prepareStatement(statement); + CachedRowSet data = RowSetProvider.newFactory().createCachedRowSet()) { if (arguments != null) { prepareStatementForExecuteUpdate(arguments, ps); } @@ -227,7 +225,6 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito LOGGER.debug("SQL SUCCESS. rows returned: {}, time(ms): {}", data.size(), (System.currentTimeMillis() - time)); } - ps.close(); } catch (SQLException exc) { handleSqlExceptionForExecuteStatement(conn, statement, arguments, exc, time); } finally { -- cgit 1.2.3-korg