Class CollectErrorsHandler

java.lang.Object
org.forgerock.json.schema.validator.ErrorHandler
org.forgerock.json.schema.validator.CollectErrorsHandler

public class CollectErrorsHandler extends ErrorHandler
The CollectErrorsHandler implements the ErrorHandler and never throws any exception, but collects them so callers can retrieve all of them in one go.
  • Constructor Details

    • CollectErrorsHandler

      public CollectErrorsHandler()
  • Method Details

    • error

      public void error(ValidationException exception) throws SchemaException
      Receive notification of an error.

      For example, a validator would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

      The validator must continue to provide normal validation after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error.

      Filters may use this method to report other, non-JSON errors as well.

      Specified by:
      error in class ErrorHandler
      Parameters:
      exception - The error information encapsulated in a validation exception.
      Throws:
      SchemaException - Any JSON exception, possibly wrapping another exception.
    • assembleException

      @Deprecated public void assembleException() throws ValidationException
      Deprecated.
      Throws an assembled exception after the validator finished the processing.

      Implementation of this method MUST throw an Exception if the {#error()} method was called on this instance before.

      Specified by:
      assembleException in class ErrorHandler
      Throws:
      ValidationException - when this instance wraps an error message(s).
    • getExceptions

      public List<ValidationException> getExceptions()
      Returns the collected ValidationExceptions.
      Returns:
      the collected ValidationExceptions
    • hasError

      public boolean hasError()
      Get the final result of the validation.

      The default value is false. If the validator has called the {#handleError} method then it return true.

      Overrides:
      hasError in class ErrorHandler
      Returns:
      true if there was an error during the validation process.