From d5e583becc6c6d18f0497006b2eced310fa0c9cf Mon Sep 17 00:00:00 2001 From: hasuniea Date: Fri, 18 Sep 2015 15:50:03 +0530 Subject: [PATCH] refactored coding issues. --- .../device/mgt/mobile/impl/windows/WindowsDeviceManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java index 51eabc60d..3a280812b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java @@ -259,10 +259,11 @@ public class WindowsDeviceManager implements DeviceManager { boolean status; MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); try { - WindowsDAOFactory.getConnection(); + WindowsDAOFactory.beginTransaction(); status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice); WindowsDAOFactory.commitTransaction(); } catch (MobileDeviceManagementDAOException e) { + WindowsDAOFactory.rollbackTransaction(); throw new DeviceManagementException("Error while enrolling the Windows device '" + device.getDeviceIdentifier() + "'", e); } finally {