refactored code comments

revert-dabc3590
hasuniea 9 years ago
parent 5690dec4b7
commit 79e143d236

@ -101,13 +101,13 @@ public class AndroidDeviceManager implements DeviceManager {
status = true; status = true;
} catch (MobileDeviceMgtPluginException e) { } catch (MobileDeviceMgtPluginException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry instance : ", e); "Error occurred while retrieving the Registry instance", e);
} catch (RegistryException e) { } catch (RegistryException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while persisting the Registry resource of Android Configuration : ", e); "Error occurred while persisting the Registry resource of Android Configuration", e);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while parsing the Android configuration : ", e); "Error occurred while parsing the Android configuration", e);
} }
return status; return status;
} }
@ -130,13 +130,13 @@ public class AndroidDeviceManager implements DeviceManager {
return null; return null;
} catch (MobileDeviceMgtPluginException e) { } catch (MobileDeviceMgtPluginException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry instance : ", e); "Error occurred while retrieving the Registry instance", e);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while parsing the Android configuration : ", e); "Error occurred while parsing the Android configuration", e);
} catch (RegistryException e) { } catch (RegistryException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry resource of Android Configuration : ", e); "Error occurred while retrieving the Registry resource of Android Configuration", e);
} }
} }
@ -161,12 +161,10 @@ public class AndroidDeviceManager implements DeviceManager {
try { try {
AndroidDAOFactory.rollbackTransaction(); AndroidDAOFactory.rollbackTransaction();
} catch (MobileDeviceManagementDAOException mobileDAOEx) { } catch (MobileDeviceManagementDAOException mobileDAOEx) {
String msg = "Error occurred while roll back the device enrol transaction :" + String msg = "Error occurred while roll back the device enrol transaction :" + device.toString();
device.toString();
log.warn(msg, mobileDAOEx); log.warn(msg, mobileDAOEx);
} }
String msg = String msg = "Error occurred while enrolling the Android device : " + device.getDeviceIdentifier();
"Error while enrolling the Android device : " + device.getDeviceIdentifier();
throw new DeviceManagementException(msg, e); throw new DeviceManagementException(msg, e);
} }
return status; return status;
@ -187,11 +185,10 @@ public class AndroidDeviceManager implements DeviceManager {
try { try {
AndroidDAOFactory.rollbackTransaction(); AndroidDAOFactory.rollbackTransaction();
} catch (MobileDeviceManagementDAOException mobileDAOEx) { } catch (MobileDeviceManagementDAOException mobileDAOEx) {
String msg = "Error occurred while roll back the update device transaction :" + String msg = "Error occurred while roll back the update device transaction :" + device.toString();
device.toString();
log.warn(msg, mobileDAOEx); log.warn(msg, mobileDAOEx);
} }
String msg = "Error while updating the enrollment of the Android device : " + String msg = "Error occurred while updating the enrollment of the Android device : " +
device.getDeviceIdentifier(); device.getDeviceIdentifier();
throw new DeviceManagementException(msg, e); throw new DeviceManagementException(msg, e);
} }
@ -217,8 +214,7 @@ public class AndroidDeviceManager implements DeviceManager {
isEnrolled = true; isEnrolled = true;
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while checking the enrollment status of Android device : " + String msg = "Error occurred while checking the enrollment status of Android device : " + deviceId.getId();
deviceId.getId();
throw new DeviceManagementException(msg, e); throw new DeviceManagementException(msg, e);
} }
return isEnrolled; return isEnrolled;
@ -247,8 +243,7 @@ public class AndroidDeviceManager implements DeviceManager {
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while fetching the Android device: '" + "Error occurred while fetching the Android device: '" + deviceId.getId() + "'", e);
deviceId.getId() + "'", e);
} }
return device; return device;
} }
@ -292,12 +287,9 @@ public class AndroidDeviceManager implements DeviceManager {
boolean status; boolean status;
Device existingDevice = this.getDevice(deviceIdentifier); Device existingDevice = this.getDevice(deviceIdentifier);
// This object holds the current persisted device object // This object holds the current persisted device object
MobileDevice existingMobileDevice = MobileDevice existingMobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(existingDevice);
MobileDeviceManagementUtil.convertToMobileDevice(existingDevice);
// This object holds the newly received device object from response // This object holds the newly received device object from response
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
// Updating current object features using newer ones // Updating current object features using newer ones
existingMobileDevice.setLatitude(mobileDevice.getLatitude()); existingMobileDevice.setLatitude(mobileDevice.getLatitude());
existingMobileDevice.setLongitude(mobileDevice.getLongitude()); existingMobileDevice.setLongitude(mobileDevice.getLongitude());
@ -319,8 +311,7 @@ public class AndroidDeviceManager implements DeviceManager {
device.toString() + "'", e1); device.toString() + "'", e1);
} }
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while updating the Android device: '" + "Error occurred while updating the Android device: '" + device.getDeviceIdentifier() + "'", e);
device.getDeviceIdentifier() + "'", e);
} }
return status; return status;
} }
@ -341,8 +332,7 @@ public class AndroidDeviceManager implements DeviceManager {
} }
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while fetching all Android devices", throw new DeviceManagementException("Error occurred while fetching all Android devices", e);
e);
} }
return devices; return devices;
} }

@ -100,13 +100,13 @@ public class WindowsDeviceManager implements DeviceManager {
status = true; status = true;
} catch (MobileDeviceMgtPluginException e) { } catch (MobileDeviceMgtPluginException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry instance : ", e); "Error occurred while retrieving the Registry instance", e);
} catch (RegistryException e) { } catch (RegistryException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while persisting the Registry resource of Windows configuration : ", e); "Error occurred while persisting the Registry resource of Windows configuration", e);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while parsing the Windows configuration : ", e); "Error occurred while parsing the Windows configuration", e);
} }
return status; return status;
} }
@ -128,13 +128,13 @@ public class WindowsDeviceManager implements DeviceManager {
return null; return null;
} catch (MobileDeviceMgtPluginException e) { } catch (MobileDeviceMgtPluginException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry instance : ", e); "Error occurred while retrieving the Registry instance", e);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while parsing the Windows configuration : ", e); "Error occurred while parsing the Windows configuration", e);
} catch (RegistryException e) { } catch (RegistryException e) {
throw new DeviceManagementException( throw new DeviceManagementException(
"Error occurred while retrieving the Registry resource of Windows configuration : ", e); "Error occurred while retrieving the Registry resource of Windows configuration", e);
} }
} }
@ -153,8 +153,8 @@ public class WindowsDeviceManager implements DeviceManager {
WindowsDAOFactory.commitTransaction(); WindowsDAOFactory.commitTransaction();
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
WindowsDAOFactory.rollbackTransaction(); WindowsDAOFactory.rollbackTransaction();
throw new DeviceManagementException("Error while updating the enrollment of the Windows device : " + throw new DeviceManagementException("Error occurred while updating the enrollment of the " +
device.getDeviceIdentifier(), e); "Windows device : " + device.getDeviceIdentifier(), e);
} finally { } finally {
WindowsDAOFactory.closeConnection(); WindowsDAOFactory.closeConnection();
} }
@ -303,7 +303,7 @@ public class WindowsDeviceManager implements DeviceManager {
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
WindowsDAOFactory.rollbackTransaction(); WindowsDAOFactory.rollbackTransaction();
throw new DeviceManagementException("Error while enrolling the windows device : " throw new DeviceManagementException("Error occurred while enrolling the windows device : "
+ device.getDeviceIdentifier(), e); + device.getDeviceIdentifier(), e);
} }
return status; return status;

Loading…
Cancel
Save