public InvalidContentDiagnosedException(OperationContext context, InvalidContentException cause) { super(context,cause,diagnose(cause)); this.constraintReportLink = RetrievalScenario. constraintReportLink( context, cause.getConstraintsId()); }
private OperationContextException diagnoseApplicationExecutionException(OperationContext context, ApplicationExecutionException exception) { OperationContextException result = null; final Throwable rootCause=exception.getCause(); if(rootCause instanceof InvalidContentException) { final InvalidContentException ice = (InvalidContentException)exception.getCause(); if(ice.getConstraintsId()==null) { result=new InternalServerException(context,NO_CONSTRAINT_REPORT_ID_DEFINED_ERROR,ice); } else { result=new InvalidContentDiagnosedException(context,ice); } } else if (rootCause instanceof UnknownResourceException) { throw new WebApplicationException(Status.NOT_FOUND); } else if (rootCause instanceof InvalidQueryException) { result=new InvalidQueryDiagnosedException(context, (InvalidQueryException)rootCause); } else if (rootCause instanceof ApplicationRuntimeException) { result=new InternalServerException(context,rootCause); } else { result=new InternalServerException(context,exception); } return result; }