From 77dc0f257c3dd2b7ac7a4b4947c387b5336e0933 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Wed, 17 Feb 2016 12:05:58 +0530 Subject: [PATCH] refactored code issues --- .../mobile/impl/android/AndroidDeviceManager.java | 15 ++++++++------- .../mobile/impl/windows/WindowsDeviceManager.java | 10 +++++----- 2 files changed, 13 insertions(+), 12 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 472589e6cb..2764df3c8e 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 @@ -69,7 +69,7 @@ public class AndroidDeviceManager implements DeviceManager { } catch (LicenseManagementException e) { log.error("Error occurred while adding default license for Android devices", e); } catch (DeviceManagementException e) { - log.error("Error occurred while adding supported device features for Android platform", e); + throw new IllegalStateException("Error occurred while adding Android features to the DB."); } } @@ -101,13 +101,14 @@ public class AndroidDeviceManager implements DeviceManager { status = true; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + "Error occurred while retrieving the Registry instance : ", e); } catch (RegistryException e) { throw new DeviceManagementException( - "Error occurred while persisting the Registry resource of Android Configuration : " + e.getMessage(), e); + "Error occurred while persisting the Registry resource of Android Configuration : " + + e.getMessage(), e); } catch (JAXBException e) { throw new DeviceManagementException( - "Error occurred while parsing the Android configuration : " + e.getMessage(), e); + "Error occurred while parsing the Android configuration : ", e); } return status; } @@ -130,13 +131,13 @@ public class AndroidDeviceManager implements DeviceManager { return null; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + "Error occurred while retrieving the Registry instance : ", e); } catch (JAXBException e) { throw new DeviceManagementException( - "Error occurred while parsing the Android configuration : " + e.getMessage(), e); + "Error occurred while parsing the Android configuration : ", e); } catch (RegistryException e) { throw new DeviceManagementException( - "Error occurred while retrieving the Registry resource of Android Configuration : " + e.getMessage(), e); + "Error occurred while retrieving the Registry resource of Android Configuration : ", e); } } 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 7e75cb63bf..531be5c23b 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 @@ -100,13 +100,13 @@ public class WindowsDeviceManager implements DeviceManager { status = true; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + "Error occurred while retrieving the Registry instance : ", e); } catch (RegistryException e) { throw new DeviceManagementException( - "Error occurred while persisting the Registry resource of Windows configuration : " + e.getMessage(), e); + "Error occurred while persisting the Registry resource of Windows configuration : ", e); } catch (JAXBException e) { throw new DeviceManagementException( - "Error occurred while parsing the Windows configuration : " + e.getMessage(), e); + "Error occurred while parsing the Windows configuration : ", e); } return status; } @@ -128,10 +128,10 @@ public class WindowsDeviceManager implements DeviceManager { return null; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + "Error occurred while retrieving the Registry instance : ", e); } catch (JAXBException e) { throw new DeviceManagementException( - "Error occurred while parsing the Windows configuration : " + e.getMessage(), e); + "Error occurred while parsing the Windows configuration : ", e); } catch (RegistryException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry resource of Windows configuration : " +