javax.validation.ConstraintDefinitionException Java Examples
The following examples show how to use
javax.validation.ConstraintDefinitionException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResteasyViolationExceptionMapper.java From quarkus with Apache License 2.0 | 6 votes |
@Override public Response toResponse(ValidationException exception) { if (exception instanceof ConstraintDefinitionException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof ConstraintDeclarationException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof GroupDefinitionException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof ResteasyViolationException) { ResteasyViolationException resteasyViolationException = ResteasyViolationException.class.cast(exception); Exception e = resteasyViolationException.getException(); if (e != null) { return buildResponse(unwrapException(e), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } else if (resteasyViolationException.getReturnValueViolations().size() == 0) { return buildViolationReportResponse(resteasyViolationException, Status.BAD_REQUEST); } else { return buildViolationReportResponse(resteasyViolationException, Status.INTERNAL_SERVER_ERROR); } } return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); }
Example #2
Source File: ValidationExceptionMapper.java From jaxrs-beanvalidation-javaee7 with Apache License 2.0 | 6 votes |
@Override public Response toResponse(ValidationException exception) { if (exception instanceof ConstraintDefinitionException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof ConstraintDeclarationException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof GroupDefinitionException) { return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } if (exception instanceof ResteasyViolationException) { ResteasyViolationException resteasyViolationException = ResteasyViolationException.class.cast(exception); Exception e = resteasyViolationException.getException(); if (e != null) { return buildResponse(unwrapException(e), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); } else if (resteasyViolationException.getReturnValueViolations().size() == 0) { return buildViolationReportResponse(resteasyViolationException, Status.BAD_REQUEST); } else { return buildViolationReportResponse(resteasyViolationException, Status.INTERNAL_SERVER_ERROR); } } return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); }
Example #3
Source File: ClassValidationData.java From tomee with Apache License 2.0 | 5 votes |
private static List<ConstraintD<?>> getConstraints(final ApacheValidatorFactory factory, final Method method) { final List<ConstraintD<?>> constraints = new ArrayList<>(); final Meta.ForMethod meta = new Meta.ForMethod(method); for (final Annotation annotation : method.getAnnotations()) { try { final ConstraintD constraint = new ConstraintD(annotation, Scope.LOCAL_ELEMENT, meta, factory); constraints.add(constraint); } catch (ConstraintDefinitionException e) { // ignore } } return constraints; }
Example #4
Source File: UriTypeValidator.java From fess with Apache License 2.0 | 5 votes |
@Override public void initialize(final UriType uriType) { switch (uriType.protocolType()) { case WEB: protocols = ComponentUtil.getFessConfig().getCrawlerWebProtocolsAsArray(); break; case FILE: protocols = ComponentUtil.getFessConfig().getCrawlerFileProtocolsAsArray(); break; default: throw new ConstraintDefinitionException("protocolType is emtpy."); } }