summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}