From b84ab092b638b5babc0c9c4c3a11d39deb03c695 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Mon, 16 Jul 2018 11:11:04 +0900 Subject: [PATCH] Fix sonar issue in SqlResource.java Add finally clause to close ResultSet Issue-ID: CCSDK-332 Change-Id: I1b856123caf56fad08064c63013cfe0859c2ae53 Signed-off-by: Parshad Patel --- .../org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java index 1c0a0087..767fdac7 100755 --- a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java +++ b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java @@ -455,14 +455,15 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin { LOG.warn("Cannot decrypt " + tableName + "." + colName); } } catch (Exception e) { - if (results != null) { + LOG.error("Caught exception trying to decrypt " + tableName + "." + colName, e); + }finally { + if (results != null) { try { results.close(); - } catch (SQLException ignored) { - + } catch (SQLException se) { + LOG.error("Caught exception trying to close ResultSet",se); } } - LOG.error("Caught exception trying to decrypt " + tableName + "." + colName, e); } } return (strValue); -- 2.16.6