public ViolationReport(final ResteasyViolationException exception) { Exception e = exception.getException(); if (e != null) { this.exception = e.toString(); } this.fieldViolations = (ArrayList<ResteasyConstraintViolation>) exception.getFieldViolations(); this.propertyViolations = (ArrayList<ResteasyConstraintViolation>) exception.getPropertyViolations(); this.classViolations = (ArrayList<ResteasyConstraintViolation>) exception.getClassViolations(); this.parameterViolations = (ArrayList<ResteasyConstraintViolation>) exception.getParameterViolations(); this.returnValueViolations = (ArrayList<ResteasyConstraintViolation>) exception.getReturnValueViolations(); }
Exception e = resteasyViolationException.getException(); if (e != null)
@Override public Response toResponse(ValidationException exception) { if (exception instanceof ResteasyViolationException) { ResteasyViolationException resteasyViolationException = ResteasyViolationException.class.cast(exception); Exception e = resteasyViolationException.getException(); if (e == null) { return buildViolationReportResponse(resteasyViolationException); } } // Common response return exceptionResponse(exception); }
public ViolationReport(ResteasyViolationException exception) { Exception e = exception.getException(); if (e != null) { this.exception = e.toString(); } this.fieldViolations = (ArrayList<ResteasyConstraintViolation>) exception.getFieldViolations(); this.propertyViolations = (ArrayList<ResteasyConstraintViolation>) exception.getPropertyViolations(); this.classViolations = (ArrayList<ResteasyConstraintViolation>) exception.getClassViolations(); this.parameterViolations = (ArrayList<ResteasyConstraintViolation>) exception.getParameterViolations(); this.returnValueViolations = (ArrayList<ResteasyConstraintViolation>) exception.getReturnValueViolations(); }
public ViolationReport(final ResteasyViolationException exception) { Exception e = exception.getException(); if (e != null) { this.exception = e.toString(); } this.fieldViolations = (ArrayList<ResteasyConstraintViolation>) exception.getFieldViolations(); this.propertyViolations = (ArrayList<ResteasyConstraintViolation>) exception.getPropertyViolations(); this.classViolations = (ArrayList<ResteasyConstraintViolation>) exception.getClassViolations(); this.parameterViolations = (ArrayList<ResteasyConstraintViolation>) exception.getParameterViolations(); this.returnValueViolations = (ArrayList<ResteasyConstraintViolation>) exception.getReturnValueViolations(); }
@Override public Response toResponse(ResteasyViolationException resteasyViolationException) { ErrorMessage em = new ErrorMessage(); Exception e = resteasyViolationException.getException(); List<ResteasyConstraintViolation> violations = resteasyViolationException.getViolations(); violations.stream() .map(ResteasyConstraintViolation::toString) .forEach(log::info); if (e != null) { em.setStatus(Status.INTERNAL_SERVER_ERROR); em.addErrorMessage(e.toString()); } else if (resteasyViolationException.getReturnValueViolations() .isEmpty()) { em.setStatus(Status.BAD_REQUEST); em.setErrorMessageList(extractMessages(violations)); } else { em.setStatus(Status.INTERNAL_SERVER_ERROR); em.setErrorMessageList(extractMessages(violations)); } return em.toResponse(); }
@Override public Response toResponse(ResteasyViolationException resteasyViolationException) { ErrorMessage em = new ErrorMessage(); Exception e = resteasyViolationException.getException(); List<ResteasyConstraintViolation> violations = resteasyViolationException.getViolations(); List<String> messageViolations = this.extractMessages(violations); messageViolations.stream() .forEach(log::info); if (e != null) { em.setStatus(Status.INTERNAL_SERVER_ERROR); em.addErrorMessage(e.toString()); } else if (resteasyViolationException.getReturnValueViolations() .isEmpty()) { em.setStatus(Status.BAD_REQUEST); em.setErrorMessageList(messageViolations); } else { em.setStatus(Status.INTERNAL_SERVER_ERROR); em.setErrorMessageList(messageViolations); } return em.toResponse(); }
Exception e = resteasyViolationException.getException(); if (e != null)
Exception e = resteasyViolationException.getException(); if (e != null)