Rename exception class names in android module

revert-dabc3590
lasanthaDLPDS 5 years ago
parent e4a789c2a4
commit fd04cd7b12

@ -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.dto.AndroidEnterpriseUser;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; 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.EnterpriseServiceException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; 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.AndroidAPIUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils;
@ -120,11 +120,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
} catch (EnterpriseServiceException e) { } catch (EnterpriseServiceException e) {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving user").build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving user").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -209,11 +209,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.status(Response.Status.NOT_FOUND).entity( return Response.status(Response.Status.NOT_FOUND).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -267,11 +267,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when calling get web token").build()) new ErrorResponse.ErrorResponseBuilder().setMessage("Error when calling get web token").build())
.build(); .build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -307,11 +307,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when persisting app").build()) new ErrorResponse.ErrorResponseBuilder().setMessage("Error when persisting app").build())
.build(); .build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -367,11 +367,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting page "
+ page.getPageName() + " , due to an error with ESA").build() ).build(); + page.getPageName() + " , due to an error with ESA").build() ).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -407,11 +407,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page "
+ page.getPageName() + " , due to an error with ESA").build()).build(); + page.getPageName() + " , due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -447,11 +447,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page "
+ id + " , Due to an error with ESA").build()).build(); + id + " , Due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -480,11 +480,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page "
+ " , Due to an error with ESA").build()).build(); + " , Due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -519,11 +519,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting home page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting home page "
+ id + " , due to an error with ESA").build() ).build(); + id + " , due to an error with ESA").build() ).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -551,11 +551,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching home page.").build() ) new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching home page.").build() )
.build(); .build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -600,11 +600,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster "
+ storeCluster.getName() + " , due to an error with ESA").build()).build(); + storeCluster.getName() + " , due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -649,11 +649,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster "
+ storeCluster.getName() + " , due to an error with ESA").build()).build(); + storeCluster.getName() + " , due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -691,11 +691,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when deleting cluster " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when deleting cluster "
+ clusterId + " , due to an error with ESA").build()).build(); + clusterId + " , due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -773,11 +773,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching all details in PageId " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching all details in PageId "
+ pageId).build()).build(); + pageId).build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -807,11 +807,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page "
+ " , Due to an error with ESA").build()).build(); + " , Due to an error with ESA").build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -990,11 +990,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.status(Response.Status.NOT_FOUND).entity( return Response.status(Response.Status.NOT_FOUND).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
@ -1083,11 +1083,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} }
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
return Response.serverError().entity( return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();

@ -209,13 +209,13 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(msg).build()).build(); .setMessage(msg).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "The payload of the android device enrollment is incorrect."; String errorMessage = "The payload of the android device enrollment is incorrect.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "The device to be modified doesn't exist."; String errorMessage = "The device to be modified doesn't exist.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.NOT_FOUND).entity( return Response.status(Response.Status.NOT_FOUND).entity(

@ -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.WifiBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; 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.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.common.spi.AndroidService;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e) { } catch (BadRequestException e) {
String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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"; String errorMessage = "Issue in retrieving operation management service instance";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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"; String errorMessage = "Issue in retrieving operation management service instance";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( 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( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.BAD_REQUEST).entity( return Response.status(Response.Status.BAD_REQUEST).entity(

@ -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.AndroidPlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; 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.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.common.spi.AndroidService;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
@ -91,7 +91,7 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP
androidService.updateConfiguration(androidPlatformConfiguration); androidService.updateConfiguration(androidPlatformConfiguration);
return Response.status(Response.Status.OK) return Response.status(Response.Status.OK)
.entity("Android platform configuration has been updated successfully.").build(); .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."; String msg = "The payload of the android platform configuration is incorrect.";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity( return Response.status(Response.Status.BAD_REQUEST).entity(

@ -60,7 +60,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Error occurred while getting the Data publisher Service instance."; String errorMessage = "Error occurred while getting the Data publisher Service instance.";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
@ -89,7 +89,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI {
AndroidService androidService = AndroidAPIUtils.getAndroidService(); AndroidService androidService = AndroidAPIUtils.getAndroidService();
List<DeviceState> deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); List<DeviceState> deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince);
return Response.status(Response.Status.OK).entity(deviceStates).build(); return Response.status(Response.Status.OK).entity(deviceStates).build();
} catch (BadRequestExceptionDup e){ } catch (BadRequestException e){
String errorMessage = "Request must contain " + String errorMessage = "Request must contain " +
"the device identifier. Optionally, both from and to value should be present to get " + "the device identifier. Optionally, both from and to value should be present to get " +
"alerts between times."; "alerts between times.";
@ -97,7 +97,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI {
return Response.status(Response.Status.BAD_REQUEST).entity( return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
.setMessage(errorMessage).build()).build(); .setMessage(errorMessage).build()).build();
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Class not found"; String errorMessage = "Class not found";
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.NOT_FOUND).entity( return Response.status(Response.Status.NOT_FOUND).entity(

@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception;
/** /**
* Represents the exception thrown during validating the request. * 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); super(message, ex);
} }
public NotFoundExceptionDup(String message) { public BadRequestException(String message) {
super(message); super(message);
} }
} }

@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception;
/** /**
* Represents the exception thrown during validating the request. * 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); super(message, ex);
} }
public BadRequestExceptionDup(String message) { public NotFoundException(String message) {
super(message); super(message);
} }
} }

@ -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);
}
}

@ -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);
}
}

@ -145,7 +145,7 @@ public class AndroidServiceImpl implements AndroidService {
if (androidPlatformConfiguration == null) { if (androidPlatformConfiguration == null) {
String errorMessage = "The payload of the android platform configuration is null."; String errorMessage = "The payload of the android platform configuration is null.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
configuration.setConfiguration(androidPlatformConfiguration.getConfiguration()); configuration.setConfiguration(androidPlatformConfiguration.getConfiguration());
try { try {
@ -170,7 +170,7 @@ public class AndroidServiceImpl implements AndroidService {
} else { } else {
String msg = "No value specified for notifierFrequency."; String msg = "No value specified for notifierFrequency.";
log.error(msg); log.error(msg);
throw new BadRequestExceptionDup(msg); throw new BadRequestException(msg);
} }
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) { } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) {
if (entry.getValue() != null) { if (entry.getValue() != null) {
@ -178,7 +178,7 @@ public class AndroidServiceImpl implements AndroidService {
} else { } else {
String msg = "No value specified for notifierType."; String msg = "No value specified for notifierType.";
log.error(msg); log.error(msg);
throw new BadRequestExceptionDup(msg); throw new BadRequestException(msg);
} }
} }
} }
@ -255,7 +255,7 @@ public class AndroidServiceImpl implements AndroidService {
|| fileTransferBeanWrapper.getDeviceIDs() == null) { || fileTransferBeanWrapper.getDeviceIDs() == null) {
String errorMessage = "The payload of the file transfer operation is incorrect."; String errorMessage = "The payload of the file transfer operation is incorrect.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs());
@ -277,7 +277,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found.";
log.error(errorMessage, e); 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) { if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) {
String errorMessage = "Lock bean is empty."; String errorMessage = "Lock bean is empty.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
DeviceLock lock = deviceLockBeanWrapper.getOperation(); DeviceLock lock = deviceLockBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -301,7 +301,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the configure camera operation is incorrect."; String errorMessage = "The payload of the configure camera operation is incorrect.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
Camera camera = cameraBeanWrapper.getOperation(); Camera camera = cameraBeanWrapper.getOperation();
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
@ -369,7 +369,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) {
String errorMessage = "WipeData bean is empty."; String errorMessage = "WipeData bean is empty.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
WipeData wipeData = wipeDataBeanWrapper.getOperation(); WipeData wipeData = wipeDataBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -436,7 +436,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); log.error(errorMessage, e);
throw new BadRequestExceptionDup(errorMessage, e); throw new BadRequestException(errorMessage, e);
} }
} }
@ -524,7 +524,7 @@ public class AndroidServiceImpl implements AndroidService {
null) { null) {
String errorMessage = "The payload of the application installing operation is incorrect"; String errorMessage = "The payload of the application installing operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation();
@ -541,7 +541,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the application update operation is incorrect"; String errorMessage = "The payload of the application update operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation();
validateApplicationUrl(applicationUpdate.getUrl()); validateApplicationUrl(applicationUpdate.getUrl());
@ -569,7 +569,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { applicationUninstallationBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the application uninstalling operation is incorrect"; String errorMessage = "The payload of the application uninstalling operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
validateApplicationType(applicationUninstallation.getType()); validateApplicationType(applicationUninstallation.getType());
@ -595,7 +595,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the blacklisting apps operation is incorrect"; String errorMessage = "The payload of the blacklisting apps operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -618,7 +618,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the upgrade firmware operation is incorrect"; String errorMessage = "The payload of the upgrade firmware operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation();
validateScheduleDate(upgradeFirmware.getSchedule()); validateScheduleDate(upgradeFirmware.getSchedule());
@ -643,7 +643,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) {
String errorMessage = "The payload of the VPN operation is incorrect"; String errorMessage = "The payload of the VPN operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
Vpn vpn = vpnConfiguration.getOperation(); Vpn vpn = vpnConfiguration.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -665,7 +665,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the notification operation is incorrect"; String errorMessage = "The payload of the notification operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
Notification notification = notificationBeanWrapper.getOperation(); Notification notification = notificationBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -687,7 +687,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the wifi operation is incorrect"; String errorMessage = "The payload of the wifi operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
Wifi wifi = wifiBeanWrapper.getOperation(); Wifi wifi = wifiBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -710,7 +710,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the device encryption operation is incorrect"; String errorMessage = "The payload of the device encryption operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation();
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
@ -732,7 +732,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the change lock code operation is incorrect"; String errorMessage = "The payload of the change lock code operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
LockCode lockCode = lockCodeBeanWrapper.getOperation(); LockCode lockCode = lockCodeBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -754,7 +754,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the change password policy operation is incorrect"; String errorMessage = "The payload of the change password policy operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -778,7 +778,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the add webclip operation is incorrect"; String errorMessage = "The payload of the add webclip operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
WebClip webClip = webClipBeanWrapper.getOperation(); WebClip webClip = webClipBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -802,7 +802,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the global proxy operation is incorrect"; String errorMessage = "The payload of the global proxy operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation();
@ -828,12 +828,12 @@ public class AndroidServiceImpl implements AndroidService {
} else { } else {
String errorMessage = "The payload of the global proxy operation is incorrect"; String errorMessage = "The payload of the global proxy operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the application configuration operation is incorrect"; String errorMessage = "The payload of the application configuration operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation(); ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -852,10 +852,10 @@ public class AndroidServiceImpl implements AndroidService {
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(applicationRestriction.toJSON()); operation.setPayLoad(applicationRestriction.toJSON());
return operation; return operation;
} catch (BadRequestExceptionDup e) { } catch (BadRequestException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
log.error(errorMessage, e); 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) { if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the display message operation is incorrect"; String errorMessage = "The payload of the display message operation is incorrect";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation();
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -881,7 +881,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found."; String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e); 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) { } catch (OperationManagementException e) {
String msg = "Issue in retrieving operation management service instance"; String msg = "Issue in retrieving operation management service instance";
log.error(msg, e); 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 " + String msg = "Error occurred while updating the device location upon android " +
"', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'";
log.error(msg, e); 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 '" + "', which carries the id '" +
androidDevice.getDeviceIdentifier() + "'"; androidDevice.getDeviceIdentifier() + "'";
log.error(msg, e); 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 '" + String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" +
id + "'"; id + "'";
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorExceptionDup(msg, e); throw new UnexpectedServerErrorException(msg, e);
} }
if (androidDevice == null) { if (androidDevice == null) {
String errorMessage = "The payload of the android device enrollment is incorrect."; String errorMessage = "The payload of the android device enrollment is incorrect.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
if (device == null) { if (device == null) {
String errorMessage = "The device to be modified doesn't exist."; String errorMessage = "The device to be modified doesn't exist.";
log.error(errorMessage); log.error(errorMessage);
throw new NotFoundExceptionDup(errorMessage); throw new NotFoundException(errorMessage);
} }
if(androidDevice.getEnrolmentInfo() != null){ if(androidDevice.getEnrolmentInfo() != null){
device.setEnrolmentInfo(device.getEnrolmentInfo()); device.setEnrolmentInfo(device.getEnrolmentInfo());
@ -1236,7 +1236,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (DataPublisherConfigurationException e) { } catch (DataPublisherConfigurationException e) {
String msg = "Error occurred while getting the Data publisher Service instance."; String msg = "Error occurred while getting the Data publisher Service instance.";
log.error(msg, e); 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 " + "the device identifier. Optionally, both from and to value should be present to get " +
"alerts between times."; "alerts between times.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
} }
private List<DeviceState> retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { private List<DeviceState> retrieveAlert(String deviceId) throws NotFoundException, UnexpectedServerErrorException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device Identifier."); log.debug("Retrieving events for given device Identifier.");
} }
@ -1273,18 +1273,19 @@ public class AndroidServiceImpl implements AndroidService {
if (deviceStates == null) { if (deviceStates == null) {
String errorMessage = "No any alerts are " + String errorMessage = "No any alerts are " +
"published for Device: " + deviceId + "."; "published for Device: " + deviceId + ".";
throw new NotFoundExceptionDup(errorMessage); throw new NotFoundException(errorMessage);
} else { } else {
return deviceStates; return deviceStates;
} }
} catch (AnalyticsException e) { } catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; String msg = "Error occurred while getting published events for specific device: " + deviceId + ".";
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorExceptionDup(msg, e); throw new UnexpectedServerErrorException(msg, e);
} }
} }
private List<DeviceState> retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { private List<DeviceState> retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundException,
UnexpectedServerErrorException {
String fromDate = String.valueOf(from); String fromDate = String.valueOf(from);
String toDate = String.valueOf(to); String toDate = String.valueOf(to);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -1298,7 +1299,7 @@ public class AndroidServiceImpl implements AndroidService {
if (deviceStates == null) { if (deviceStates == null) {
String errorMessage = "No any alerts are " + String errorMessage = "No any alerts are " +
"published on given date for given Device: " + deviceId + "."; "published on given date for given Device: " + deviceId + ".";
throw new NotFoundExceptionDup(errorMessage); throw new NotFoundException(errorMessage);
} else { } else {
return deviceStates; return deviceStates;
@ -1307,12 +1308,12 @@ public class AndroidServiceImpl implements AndroidService {
String msg = "Error occurred while getting published events for specific " + String msg = "Error occurred while getting published events for specific " +
"Device: " + deviceId + " on given Date."; "Device: " + deviceId + " on given Date.";
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorExceptionDup(msg, e); throw new UnexpectedServerErrorException(msg, e);
} }
} }
private List<DeviceState> retrieveAlertByType(String deviceId, String type) private List<DeviceState> retrieveAlertByType(String deviceId, String type)
throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { throws NotFoundException, UnexpectedServerErrorException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device identifier and type."); log.debug("Retrieving events for given device identifier and type.");
} }
@ -1323,7 +1324,7 @@ public class AndroidServiceImpl implements AndroidService {
if (deviceStates == null) { if (deviceStates == null) {
String errorMessage = "No any alerts are " + String errorMessage = "No any alerts are " +
"published for given Device: '" + deviceId + "' and given specific Type."; "published for given Device: '" + deviceId + "' and given specific Type.";
throw new NotFoundExceptionDup(errorMessage); throw new NotFoundException(errorMessage);
} else { } else {
return deviceStates; return deviceStates;
@ -1332,7 +1333,7 @@ public class AndroidServiceImpl implements AndroidService {
String msg = "Error occurred while getting published events for specific " + String msg = "Error occurred while getting published events for specific " +
"Device: " + deviceId + "and given specific Type."; "Device: " + deviceId + "and given specific Type.";
log.error(msg, e); 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); AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser);
} }
return token; return token;
} catch (NotFoundExceptionDup e) { } catch (NotFoundException e) {
String errorMessage = "Not found"; String errorMessage = "Not found";
log.error(errorMessage); log.error(errorMessage);
throw new NotFoundExceptionDup(errorMessage); throw new NotFoundException(errorMessage);
} catch (UnexpectedServerErrorExceptionDup e) { } catch (UnexpectedServerErrorException e) {
String errorMessage = "Unexpected server error"; String errorMessage = "Unexpected server error";
log.error(errorMessage); log.error(errorMessage);
throw new UnexpectedServerErrorExceptionDup(errorMessage); throw new UnexpectedServerErrorException(errorMessage);
} catch (AndroidDeviceMgtPluginException e) { } catch (AndroidDeviceMgtPluginException e) {
String errorMessage = "Error occured while executing wipe enterprice command"; String errorMessage = "Error occured while executing wipe enterprice command";
log.error(errorMessage); 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 { try {
URL url = new URL(apkUrl); URL url = new URL(apkUrl);
URLConnection conn = url.openConnection(); URLConnection conn = url.openConnection();
if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) {
String errorMessage = "URL is not pointed to a downloadable file."; String errorMessage = "URL is not pointed to a downloadable file.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
String errorMessage = "Malformed application url."; String errorMessage = "Malformed application url.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} catch (IOException e) { } catch (IOException e) {
String errorMessage = "Invalid application url."; String errorMessage = "Invalid application url.";
log.error(errorMessage); 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 (type != null) {
if (!"enterprise".equalsIgnoreCase(type) if (!"enterprise".equalsIgnoreCase(type)
&& !"public".equalsIgnoreCase(type) && !"public".equalsIgnoreCase(type)
&& !"webapp".equalsIgnoreCase(type)) { && !"webapp".equalsIgnoreCase(type)) {
String errorMessage = "Invalid application type."; String errorMessage = "Invalid application type.";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
} else { } else {
String errorMessage = "Application type is missing."; String errorMessage = "Application type is missing.";
log.error(errorMessage); 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 { try {
if (dateString != null && !dateString.isEmpty()) { if (dateString != null && !dateString.isEmpty()) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
@ -1515,7 +1516,7 @@ public class AndroidServiceImpl implements AndroidService {
} catch (ParseException e) { } catch (ParseException e) {
String errorMessage = "Issue in validating the schedule date"; String errorMessage = "Issue in validating the schedule date";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
} }
} }

@ -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.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; 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.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.AndroidGoogleEnterpriseService;
import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -179,7 +179,7 @@ public class AndroidAPIUtils {
if (deviceIDs == null || deviceIDs.isEmpty()) { if (deviceIDs == null || deviceIDs.isEmpty()) {
String errorMessage = "Device identifier list is empty"; String errorMessage = "Device identifier list is empty";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
DeviceIdentifier deviceIdentifier; DeviceIdentifier deviceIdentifier;
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();

@ -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.bean.wrapper.EnterpriseInstallPolicy;
import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; 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.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.device.mgt.mobile.android.common.exception.EnterpriseServiceException;
import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException; import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
@ -145,7 +145,7 @@ public class AndroidDeviceUtils {
if (deviceIDs == null || deviceIDs.isEmpty()) { if (deviceIDs == null || deviceIDs.isEmpty()) {
String errorMessage = "Device identifier list is empty"; String errorMessage = "Device identifier list is empty";
log.error(errorMessage); log.error(errorMessage);
throw new BadRequestExceptionDup(errorMessage); throw new BadRequestException(errorMessage);
} }
DeviceIdentifier deviceIdentifier; DeviceIdentifier deviceIdentifier;
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();

@ -225,9 +225,9 @@ public class AndroidEnterpriseUtils {
EnterpriseConfigs enterpriseConfigs = getEnterpriseConfigsFromGoogle(); EnterpriseConfigs enterpriseConfigs = getEnterpriseConfigsFromGoogle();
if (enterpriseConfigs.getErrorResponse() != null) { if (enterpriseConfigs.getErrorResponse() != null) {
if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { if (enterpriseConfigs.getErrorResponse().getCode() == 500l) {
throw new UnexpectedServerErrorExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); throw new UnexpectedServerErrorException(enterpriseConfigs.getErrorResponse().getMessage());
} else if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { } else if (enterpriseConfigs.getErrorResponse().getCode() == 500l) {
throw new NotFoundExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); throw new NotFoundException(enterpriseConfigs.getErrorResponse().getMessage());
} }
} }
return enterpriseConfigs; return enterpriseConfigs;

Loading…
Cancel
Save