/** * Get a ValidationFailure object containing information from this ValidationException * @return a ValidationFailure object */ public ValidationFailure getValidationFailure() { if (failure != null) { return failure; } else { ValidationFailure failure = new ValidationFailure(getMessage()); failure.setErrorCodeQName(getErrorCodeQName()); failure.setLocator(getLocator()); return failure; } }
/** * Get a ValidationFailure object containing information from this ValidationException * @return a ValidationFailure object */ public ValidationFailure getValidationFailure() { if (failure != null) { return failure; } else { ValidationFailure failure = new ValidationFailure(getMessage()); failure.setErrorCodeQName(getErrorCodeQName()); failure.setLocator(getLocator()); return failure; } }
/** * Creates a new ValidationFailure with the given nested * exception. * * @param exception the nested exception */ public static ValidationFailure fromException(/*@NotNull*/ Exception exception) { if (exception instanceof ValidationException) { return ((ValidationException)exception).getValidationFailure(); } else if (exception instanceof XPathException) { ValidationFailure failure = new ValidationFailure(exception.getMessage()); if (((XPathException) exception).getErrorCodeQName() == null) { failure.setErrorCode("FORG0001"); } else { failure.setErrorCodeQName(((XPathException) exception).getErrorCodeQName()); } failure.setLocator(((XPathException) exception).getLocator()); return failure; } else { return new ValidationFailure(exception.getMessage()); } }
/** * Creates a new ValidationFailure with the given nested * exception. * * @param exception the nested exception */ public static ValidationFailure fromException(/*@NotNull*/ Exception exception) { if (exception instanceof ValidationException) { return ((ValidationException)exception).getValidationFailure(); } else if (exception instanceof XPathException) { ValidationFailure failure = new ValidationFailure(exception.getMessage()); if (((XPathException) exception).getErrorCodeQName() == null) { failure.setErrorCode("FORG0001"); } else { failure.setErrorCodeQName(((XPathException) exception).getErrorCodeQName()); } failure.setLocator(((XPathException) exception).getLocator()); return failure; } else { return new ValidationFailure(exception.getMessage()); } }