diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index 58ef349f3b..23bbfa5532 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -60,8 +60,8 @@ import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseMan import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; @@ -120,11 +120,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } catch (EnterpriseServiceException e) { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving user").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -209,11 +209,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -267,11 +267,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when calling get web token").build()) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -307,11 +307,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when persisting app").build()) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -367,11 +367,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting page " + page.getPageName() + " , due to an error with ESA").build() ).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -407,11 +407,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + page.getPageName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -447,11 +447,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + id + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -480,11 +480,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -519,11 +519,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting home page " + id + " , due to an error with ESA").build() ).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -551,11 +551,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching home page.").build() ) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -600,11 +600,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -649,11 +649,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -691,11 +691,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when deleting cluster " + clusterId + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -773,11 +773,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching all details in PageId " + pageId).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -807,11 +807,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -990,11 +990,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -1083,11 +1083,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 70daaccec7..bccd9a4ced 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -209,13 +209,13 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(msg).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage, e); return Response.status(Response.Status.NOT_FOUND).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 28d8da1239..ab0581a996 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -64,7 +64,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBean import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -98,7 +98,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -131,7 +131,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -164,7 +164,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -197,7 +197,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -230,7 +230,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -263,7 +263,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -294,7 +294,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -325,7 +325,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -358,7 +358,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -391,7 +391,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -424,7 +424,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -457,7 +457,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -490,7 +490,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -523,7 +523,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -556,7 +556,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -590,7 +590,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -623,7 +623,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -657,7 +657,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -690,7 +690,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -723,7 +723,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -756,7 +756,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -789,7 +789,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -822,7 +822,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -855,7 +855,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -888,7 +888,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -921,7 +921,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -954,7 +954,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -989,7 +989,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -1030,7 +1030,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -1064,7 +1064,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java index 30e27039e5..86cf589630 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -44,7 +44,7 @@ import org.wso2.carbon.device.mgt.mobile.android.api.DeviceTypeConfigurationAPI; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -91,7 +91,7 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP androidService.updateConfiguration(androidPlatformConfiguration); return Response.status(Response.Status.OK) .entity("Android platform configuration has been updated successfully.").build(); - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String msg = "The payload of the android platform configuration is incorrect."; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 3011763d8e..fa60ca4764 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -60,7 +60,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Error occurred while getting the Data publisher Service instance."; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( @@ -89,7 +89,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { AndroidService androidService = AndroidAPIUtils.getAndroidService(); List deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); return Response.status(Response.Status.OK).entity(deviceStates).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Request must contain " + "the device identifier. Optionally, both from and to value should be present to get " + "alerts between times."; @@ -97,7 +97,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Class not found"; log.error(errorMessage, e); return Response.status(Response.Status.NOT_FOUND).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java similarity index 82% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java index 6d0f90cef2..3ca97f7f63 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java @@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Represents the exception thrown during validating the request. */ -public class NotFoundExceptionDup extends AndroidDeviceMgtPluginException { +public class BadRequestException extends AndroidDeviceMgtPluginException { - public NotFoundExceptionDup(String message, Throwable ex) { + public BadRequestException(String message, Throwable ex) { super(message, ex); } - public NotFoundExceptionDup(String message) { + public BadRequestException(String message) { super(message); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java similarity index 82% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java index 0d1220e9dd..0a9679f61e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java @@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Represents the exception thrown during validating the request. */ -public class BadRequestExceptionDup extends AndroidDeviceMgtPluginException { +public class NotFoundException extends AndroidDeviceMgtPluginException { - public BadRequestExceptionDup(String message, Throwable ex) { + public NotFoundException(String message, Throwable ex) { super(message, ex); } - public BadRequestExceptionDup(String message) { + public NotFoundException(String message) { super(message); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java new file mode 100644 index 0000000000..d6490f761b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java @@ -0,0 +1,12 @@ +package org.wso2.carbon.device.mgt.mobile.android.common.exception; + +public class UnexpectedServerErrorException extends AndroidDeviceMgtPluginException{ + + public UnexpectedServerErrorException(String message, Throwable ex) { + super(message, ex); + } + + public UnexpectedServerErrorException(String message) { + super(message); + } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java deleted file mode 100644 index 156404ef3d..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; - -public class UnexpectedServerErrorExceptionDup extends AndroidDeviceMgtPluginException{ - - public UnexpectedServerErrorExceptionDup(String message, Throwable ex) { - super(message, ex); - } - - public UnexpectedServerErrorExceptionDup(String message) { - super(message); - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index 1e1c9d06de..a70324eb9b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -145,7 +145,7 @@ public class AndroidServiceImpl implements AndroidService { if (androidPlatformConfiguration == null) { String errorMessage = "The payload of the android platform configuration is null."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } configuration.setConfiguration(androidPlatformConfiguration.getConfiguration()); try { @@ -170,7 +170,7 @@ public class AndroidServiceImpl implements AndroidService { } else { String msg = "No value specified for notifierFrequency."; log.error(msg); - throw new BadRequestExceptionDup(msg); + throw new BadRequestException(msg); } } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) { if (entry.getValue() != null) { @@ -178,7 +178,7 @@ public class AndroidServiceImpl implements AndroidService { } else { String msg = "No value specified for notifierType."; log.error(msg); - throw new BadRequestExceptionDup(msg); + throw new BadRequestException(msg); } } } @@ -255,7 +255,7 @@ public class AndroidServiceImpl implements AndroidService { || fileTransferBeanWrapper.getDeviceIDs() == null) { String errorMessage = "The payload of the file transfer operation is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } if (log.isDebugEnabled()) { log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); @@ -277,7 +277,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -287,7 +287,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { String errorMessage = "Lock bean is empty."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceLock lock = deviceLockBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -301,7 +301,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -317,7 +317,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -332,7 +332,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -347,7 +347,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -358,7 +358,7 @@ public class AndroidServiceImpl implements AndroidService { if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the configure camera operation is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Camera camera = cameraBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -369,7 +369,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -384,7 +384,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -399,7 +399,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -414,7 +414,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -425,7 +425,7 @@ public class AndroidServiceImpl implements AndroidService { if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) { String errorMessage = "WipeData bean is empty."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } WipeData wipeData = wipeDataBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -436,7 +436,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -451,7 +451,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -466,7 +466,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -481,7 +481,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -496,7 +496,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -512,7 +512,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -524,7 +524,7 @@ public class AndroidServiceImpl implements AndroidService { null) { String errorMessage = "The payload of the application installing operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); @@ -541,7 +541,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -552,7 +552,7 @@ public class AndroidServiceImpl implements AndroidService { if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application update operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); validateApplicationUrl(applicationUpdate.getUrl()); @@ -569,7 +569,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -581,7 +581,7 @@ public class AndroidServiceImpl implements AndroidService { applicationUninstallationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application uninstalling operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); validateApplicationType(applicationUninstallation.getType()); @@ -595,7 +595,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -606,7 +606,7 @@ public class AndroidServiceImpl implements AndroidService { if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the blacklisting apps operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -618,7 +618,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -629,7 +629,7 @@ public class AndroidServiceImpl implements AndroidService { if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the upgrade firmware operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); validateScheduleDate(upgradeFirmware.getSchedule()); @@ -643,7 +643,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -654,7 +654,7 @@ public class AndroidServiceImpl implements AndroidService { if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) { String errorMessage = "The payload of the VPN operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Vpn vpn = vpnConfiguration.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -665,7 +665,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -676,7 +676,7 @@ public class AndroidServiceImpl implements AndroidService { if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the notification operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Notification notification = notificationBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -687,7 +687,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -698,7 +698,7 @@ public class AndroidServiceImpl implements AndroidService { if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the wifi operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Wifi wifi = wifiBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -710,7 +710,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -721,7 +721,7 @@ public class AndroidServiceImpl implements AndroidService { if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the device encryption operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -732,7 +732,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -743,7 +743,7 @@ public class AndroidServiceImpl implements AndroidService { if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change lock code operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } LockCode lockCode = lockCodeBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -754,7 +754,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -765,7 +765,7 @@ public class AndroidServiceImpl implements AndroidService { if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change password policy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -778,7 +778,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -790,7 +790,7 @@ public class AndroidServiceImpl implements AndroidService { if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the add webclip operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } WebClip webClip = webClipBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -802,7 +802,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -813,7 +813,7 @@ public class AndroidServiceImpl implements AndroidService { if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); @@ -828,12 +828,12 @@ public class AndroidServiceImpl implements AndroidService { } else { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -844,7 +844,7 @@ public class AndroidServiceImpl implements AndroidService { if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application configuration operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -852,10 +852,10 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationRestriction.toJSON()); return operation; - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -867,7 +867,7 @@ public class AndroidServiceImpl implements AndroidService { if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the display message operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -881,7 +881,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -956,7 +956,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (OperationManagementException e) { String msg = "Issue in retrieving operation management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1042,7 +1042,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while updating the device location upon android " + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1102,7 +1102,7 @@ public class AndroidServiceImpl implements AndroidService { "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1119,18 +1119,18 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + id + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } if (device == null) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage); - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } if(androidDevice.getEnrolmentInfo() != null){ device.setEnrolmentInfo(device.getEnrolmentInfo()); @@ -1236,7 +1236,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (DataPublisherConfigurationException e) { String msg = "Error occurred while getting the Data publisher Service instance."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg); + throw new UnexpectedServerErrorException(msg); } } @@ -1258,11 +1258,11 @@ public class AndroidServiceImpl implements AndroidService { "the device identifier. Optionally, both from and to value should be present to get " + "alerts between times."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private List retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlert(String deviceId) throws NotFoundException, UnexpectedServerErrorException { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device Identifier."); } @@ -1273,18 +1273,19 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published for Device: " + deviceId + "."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } - private List retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundException, + UnexpectedServerErrorException { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); if (log.isDebugEnabled()) { @@ -1298,7 +1299,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published on given date for given Device: " + deviceId + "."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; @@ -1307,12 +1308,12 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + " on given Date."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } private List retrieveAlertByType(String deviceId, String type) - throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + throws NotFoundException, UnexpectedServerErrorException { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); } @@ -1323,7 +1324,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published for given Device: '" + deviceId + "' and given specific Type."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; @@ -1332,7 +1333,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + "and given specific Type."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1453,14 +1454,14 @@ public class AndroidServiceImpl implements AndroidService { AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); } return token; - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; log.error(errorMessage); - throw new NotFoundExceptionDup(errorMessage); - } catch (UnexpectedServerErrorExceptionDup e) { + throw new NotFoundException(errorMessage); + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; log.error(errorMessage); - throw new UnexpectedServerErrorExceptionDup(errorMessage); + throw new UnexpectedServerErrorException(errorMessage); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing wipe enterprice command"; log.error(errorMessage); @@ -1469,43 +1470,43 @@ public class AndroidServiceImpl implements AndroidService { } - private static void validateApplicationUrl(String apkUrl) throws BadRequestExceptionDup{ + private static void validateApplicationUrl(String apkUrl) throws BadRequestException { try { URL url = new URL(apkUrl); URLConnection conn = url.openConnection(); if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { String errorMessage = "URL is not pointed to a downloadable file."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } catch (MalformedURLException e) { String errorMessage = "Malformed application url."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } catch (IOException e) { String errorMessage = "Invalid application url."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private static void validateApplicationType(String type) throws BadRequestExceptionDup{ + private static void validateApplicationType(String type) throws BadRequestException { if (type != null) { if (!"enterprise".equalsIgnoreCase(type) && !"public".equalsIgnoreCase(type) && !"webapp".equalsIgnoreCase(type)) { String errorMessage = "Invalid application type."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } else { String errorMessage = "Application type is missing."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private static void validateScheduleDate(String dateString) throws BadRequestExceptionDup{ + private static void validateScheduleDate(String dateString) throws BadRequestException { try { if (dateString != null && !dateString.isEmpty()) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); @@ -1515,7 +1516,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (ParseException e) { String errorMessage = "Issue in validating the schedule date"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index 8318a36bb9..dae74b5f5b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -35,7 +35,7 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManag import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -179,7 +179,7 @@ public class AndroidAPIUtils { if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index aea93e1fdd..be73152c67 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -95,7 +95,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseA import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; @@ -145,7 +145,7 @@ public class AndroidDeviceUtils { if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java index 1a10bc5385..dd516ba776 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java @@ -225,9 +225,9 @@ public class AndroidEnterpriseUtils { EnterpriseConfigs enterpriseConfigs = getEnterpriseConfigsFromGoogle(); if (enterpriseConfigs.getErrorResponse() != null) { if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new UnexpectedServerErrorExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); + throw new UnexpectedServerErrorException(enterpriseConfigs.getErrorResponse().getMessage()); } else if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new NotFoundExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); + throw new NotFoundException(enterpriseConfigs.getErrorResponse().getMessage()); } } return enterpriseConfigs;