From 7374fe8e4bb9bcf09eb217e254329c2e37603ba5 Mon Sep 17 00:00:00 2001 From: milanperera Date: Tue, 28 Jul 2015 15:35:19 +0530 Subject: [PATCH] Refactored --- .../mobile/impl/android/AndroidDeviceManager.java | 12 ++++++------ .../mgt/mobile/impl/android/util/AndroidUtils.java | 4 ---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java index 317129fd9..c6c2ef68c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java @@ -297,17 +297,17 @@ public class AndroidDeviceManager implements DeviceManager { public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException { boolean status; - Device deviceDB = this.getDevice(deviceIdentifier); + Device existingDevice = this.getDevice(deviceIdentifier); // This object holds the current persisted device object - MobileDevice mobileDeviceDB = MobileDeviceManagementUtil.convertToMobileDevice(deviceDB); + MobileDevice existingMobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(existingDevice); // This object holds the newly received device object from response MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); // Updating current object features using newer ones - mobileDeviceDB.setLatitude(mobileDevice.getLatitude()); - mobileDeviceDB.setLongitude(mobileDevice.getLongitude()); - mobileDeviceDB.setDeviceProperties(mobileDevice.getDeviceProperties()); + existingMobileDevice.setLatitude(mobileDevice.getLatitude()); + existingMobileDevice.setLongitude(mobileDevice.getLongitude()); + existingMobileDevice.setDeviceProperties(mobileDevice.getDeviceProperties()); try { if (log.isDebugEnabled()) { @@ -316,7 +316,7 @@ public class AndroidDeviceManager implements DeviceManager { } AndroidDAOFactory.beginTransaction(); status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO() - .updateMobileDevice(mobileDeviceDB); + .updateMobileDevice(existingMobileDevice); AndroidDAOFactory.commitTransaction(); } catch (MobileDeviceManagementDAOException e) { try { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java index 104856fff..d17768099 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java @@ -28,10 +28,6 @@ public class AndroidUtils { public static String getDeviceProperty(Map deviceProperties, String property) { String deviceProperty = deviceProperties.get(property); - if (deviceProperty == null) { - return ""; - } - return deviceProperty; } }