aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main/java/org/onap
diff options
context:
space:
mode:
authorAmaresh Kumar <kamaresh@in.ibm.com>2018-08-31 17:40:47 +0530
committerAmaresh Kumar <kamaresh@in.ibm.com>2018-08-31 17:41:09 +0530
commit26fb914c67acb060987671e0ce12d584d9786e54 (patch)
treecbe4028c16fd0c73438399da28fcb674c59b5e02 /datarouter-prov/src/main/java/org/onap
parente647d5737c2735262a9cee302eb82e83d19a27c1 (diff)
Sonar fix for DB.java
https://sonar.onap.org/project/issues?id=org.onap.dmaap.datarouter%3Aparent&open=AWUebYr6wGn37JfbxiDE&resolved=false&severities=BLOCKER&types=BUG Issue-ID: DMAAP-680 Change-Id: I8760e8dd945e5b5e9792dfdaf3d0193f89c573a6 Signed-off-by: Amaresh Kumar <kamaresh@in.ibm.com>
Diffstat (limited to 'datarouter-prov/src/main/java/org/onap')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java
index bbcacb53..7f0d56b7 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java
@@ -112,13 +112,16 @@ public class DB {
throw sqlEx;
}
}
+ finally {
+ if (connection != null && !connection.isValid(1)) {
+ connection.close();
+ connection = null;
+ }
+ }
} while (connection == null);
}
}
- if (connection != null && !connection.isValid(1)) {
- connection.close();
- connection = null;
- }
+
}
return connection;
}