From 80941b8d2b4252d572fa7bb98501ae2a7908c923 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Thu, 7 Sep 2017 12:29:59 +0530 Subject: [PATCH] making error messages more meaningful --- .../android/bean/wrapper/FileTransferBeanWrapper.java | 2 +- .../android/services/DeviceManagementAdminService.java | 1 - .../impl/DeviceManagementAdminServiceImpl.java | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java index 810cb6a22b..54accca6f0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java @@ -30,7 +30,7 @@ import java.util.List; description = "FileTransfer related Information.") public class FileTransferBeanWrapper { - @ApiModelProperty(name = "deviceIDs", value = "Device id list of the operation to be executed.", required = true) + @ApiModelProperty(name = "deviceIDs", value = "Device id list to which the operation to be executed.", required = true) private List deviceIDs; @ApiModelProperty(name = "operation", value = "Information of the File Transfer Operation.", required = true) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index a672d1cc32..b0e8f80db6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -232,7 +232,6 @@ public interface DeviceManagementAdminService { @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", - //todo value = "Transferring file to the device.", notes = "Using this API you have the option to transfer a file from FTP server to an Android device.", response = Activity.class, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java index 2cb3812758..033899260c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java @@ -95,12 +95,12 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe @Override public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { if (log.isDebugEnabled()) { - log.debug("Invoking Android file transfer operation"); + log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); } try { if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { - String errorMessage = "Lock bean is empty."; + String errorMessage = "The payload of the file transfer operation is incorrect."; log.error(errorMessage); throw new BadRequestException( new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); @@ -113,17 +113,17 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe operation.setPayLoad(file.toJSON()); return AndroidAPIUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; + String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); throw new BadRequestException( new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; + String errorMessage = "Issue in retrieving operation management service instance for file transfer operation"; log.error(errorMessage, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; + String errorMessage = "Issue in retrieving device management service instance for file transfer operation"; log.error(errorMessage, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());