Ravi Nori has posted comments on this change. Change subject: restapi : Add Role with wrong permit id leads to 500 error(#908392) ......................................................................
Patch Set 1: No score org.ovirt.engine.api.restapi.resource.validation.PermitValidator already has the necessary code for throwing the exception public class PermitValidator implements Validator<Permit> { @Override public void validateEnums(Permit permit) { if (permit!=null) { if (permit.isSetName()) { validateEnum(PermitType.class, permit.getName(), true); } if (permit.isSetId()) { boolean valid = false; for (PermitType permitType : PermitType.values()) { Permit mappedPermit = PermitMapper.map(permitType, (Permit)null); if (mappedPermit != null && mappedPermit.getId().equals(permit.getId())) { valid = true; break; } } if (!valid) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity(permit.getId() + " is not a valid permit ID.") .build()); } } } } } -- To view, visit http://gerrit.ovirt.org/11824 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9adfda37e67d24f96933aa4eb8f79a8fdb416d62 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <rn...@redhat.com> Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com> Gerrit-Reviewer: Ravi Nori <rn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches