Fixing transactional anomalies found in PolicyManagerImpl

revert-70aa11f8
prabathabey 9 years ago
parent cdbdc86f42
commit 05c3d080e0

@ -455,14 +455,17 @@ public class PolicyManagerImpl implements PolicyManager {
@Override @Override
public List<Policy> getPolicies() throws PolicyManagementException { public List<Policy> getPolicies() throws PolicyManagementException {
List<Policy> policyList; List<Policy> policyList;
List<Profile> profileList;
try {
profileList = profileManager.getAllProfiles();
} catch (ProfileManagementException e) {
throw new PolicyManagementException("Error occurred while getting all the profiles.", e);
}
try { try {
PolicyManagementDAOFactory.openConnection(); PolicyManagementDAOFactory.openConnection();
policyList = policyDAO.getAllPolicies(); policyList = policyDAO.getAllPolicies();
// List<Profile> profileList = profileDAO.getAllProfiles(); // List<Profile> profileList = profileDAO.getAllProfiles();
List<Profile> profileList = profileManager.getAllProfiles();
for (Policy policy : policyList) { for (Policy policy : policyList) {
for (Profile profile : profileList) { for (Profile profile : profileList) {
@ -481,8 +484,6 @@ public class PolicyManagerImpl implements PolicyManager {
Collections.sort(policyList); Collections.sort(policyList);
} catch (PolicyManagerDAOException e) { } catch (PolicyManagerDAOException e) {
throw new PolicyManagementException("Error occurred while getting all the policies.", 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) { } catch (SQLException e) {
throw new PolicyManagementException("Error occurred while opening a connection to the data source", e); throw new PolicyManagementException("Error occurred while opening a connection to the data source", e);
} finally { } finally {

Loading…
Cancel
Save