mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Add validation to APK type
(cherry picked from commit 9da85ad)
This commit is contained in:
parent
b66da8c7cb
commit
07c7f2b6ff
@ -558,6 +558,22 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
|||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||||
}
|
}
|
||||||
|
if (payload.has("type")) {
|
||||||
|
String type = payload.getString("type");
|
||||||
|
if (!"enterprise".equalsIgnoreCase(type)
|
||||||
|
&& !"public".equalsIgnoreCase(type)
|
||||||
|
&& !"webapp".equalsIgnoreCase(type)) {
|
||||||
|
String errorMessage = "Invalid application type.";
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new BadRequestException(
|
||||||
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String errorMessage = "Application type is missing.";
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new BadRequestException(
|
||||||
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||||
|
}
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
String errorMessage = "Malformed application url.";
|
String errorMessage = "Malformed application url.";
|
||||||
log.error(errorMessage);
|
log.error(errorMessage);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user