From dcac237380fe4edcda7f271e00d3b1e03ccb4982 Mon Sep 17 00:00:00 2001 From: manoj Date: Sat, 7 Feb 2015 06:36:11 +0530 Subject: [PATCH] Refactor license management --- .../wso2/carbon/mdm/mobileservices/android/Device.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/carbon/mdm/mobileservices/android/Device.java b/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/carbon/mdm/mobileservices/android/Device.java index c9e36472b0..db6ea1414e 100644 --- a/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/carbon/mdm/mobileservices/android/Device.java +++ b/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/carbon/mdm/mobileservices/android/Device.java @@ -133,7 +133,8 @@ public class Device { @GET @Path("/license") @Produces("text/plain") - public String getLicense() { + public String getLicense() throws AndroidAgentException{ + License license = null; try { try { @@ -141,10 +142,12 @@ public class Device { .MobileDeviceTypes .MOBILE_DEVICE_TYPE_ANDROID, DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); } catch (LicenseManagementException e) { - e.printStackTrace(); + String errorMsg = "License management service error"; + throw new AndroidAgentException(errorMsg, e); } }catch(DeviceManagementServiceException deviceMgtEx){ - deviceMgtEx.printStackTrace(); + String errorMsg = "Device management service error"; + throw new AndroidAgentException(errorMsg, deviceMgtEx); } return license.getLicenseText(); }