From 05c3d080e0d248ce2de7a87adefd38d30dbb0a13 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Sat, 22 Aug 2015 04:09:59 +0530 Subject: [PATCH] Fixing transactional anomalies found in PolicyManagerImpl --- .../policy/mgt/core/mgt/impl/PolicyManagerImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index cd777fb7b8..19658c340f 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -455,14 +455,17 @@ public class PolicyManagerImpl implements PolicyManager { @Override public List getPolicies() throws PolicyManagementException { - List policyList; - + List profileList; + try { + profileList = profileManager.getAllProfiles(); + } catch (ProfileManagementException e) { + throw new PolicyManagementException("Error occurred while getting all the profiles.", e); + } try { PolicyManagementDAOFactory.openConnection(); policyList = policyDAO.getAllPolicies(); // List profileList = profileDAO.getAllProfiles(); - List profileList = profileManager.getAllProfiles(); for (Policy policy : policyList) { for (Profile profile : profileList) { @@ -481,8 +484,6 @@ public class PolicyManagerImpl implements PolicyManager { Collections.sort(policyList); } catch (PolicyManagerDAOException e) { throw new PolicyManagementException("Error occurred while getting all the policies.", e); - } catch (ProfileManagementException e) { - throw new PolicyManagementException("Error occurred while getting all the profiles.", e); } catch (SQLException e) { throw new PolicyManagementException("Error occurred while opening a connection to the data source", e); } finally {