diff --git a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java index 37586d144..f12f340f5 100644 --- a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java +++ b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java @@ -33,7 +33,7 @@ public class WorkflowAPIConsumerImpl implements WorkflowAPIConsumer { @Override public int getAPIID(APIIdentifier apiId) throws APIManagementException { int id = -1; - Connection connection; + Connection connection = null; try { connection = APIMgtDBUtil.getConnection(); @@ -43,6 +43,8 @@ public int getAPIID(APIIdentifier apiId) throws APIManagementException { handleException("Failed to retrieve api id. ", e); } catch (APIManagementException e) { handleException("Error occured in retrieving api id. ", e); + } finally { + APIMgtDBUtil.closeAllConnections(null, connection, null); } return id; }