Merge "Sonar fix for DB.java"
authorRam Koya <rk541m@att.com>
Fri, 31 Aug 2018 15:25:38 +0000 (15:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 31 Aug 2018 15:25:38 +0000 (15:25 +0000)
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java

index bbcacb5..7f0d56b 100644 (file)
@@ -112,13 +112,16 @@ public class DB {
                                 throw sqlEx;\r
                             }\r
                         }\r
+                        finally {\r
+                            if (connection != null && !connection.isValid(1)) {\r
+                                connection.close();\r
+                                connection = null;\r
+                            }\r
+                        }\r
                     } while (connection == null);\r
                 }\r
             }\r
-            if (connection != null && !connection.isValid(1)) {\r
-                connection.close();\r
-                connection = null;\r
-            }\r
+\r
         }\r
         return connection;\r
     }\r