Fix sonar issue in SqlResource.java 69/56469/2
authorParshad Patel <pars.patel@samsung.com>
Mon, 16 Jul 2018 02:11:04 +0000 (11:11 +0900)
committerParshad Patel <pars.patel@samsung.com>
Mon, 16 Jul 2018 07:26:21 +0000 (16:26 +0900)
Add finally clause to close ResultSet

Issue-ID: CCSDK-332
Change-Id: I1b856123caf56fad08064c63013cfe0859c2ae53
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java

index 1c0a008..767fdac 100755 (executable)
@@ -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);