Class DataValidationException

All Implemented Interfaces:
Serializable

public class DataValidationException extends DataProcessingException
A DataValidationException is an error thrown during the processing of a record successfully parsed, but whose data failed to pass a validation defined by annotation Validate
Author:
Univocity Software Pty Ltd - parsers@univocity.com
See Also:
  • Field Details

    • errorContentLength

      protected int errorContentLength
  • Constructor Details

    • DataValidationException

      public DataValidationException(String message)
      Creates a new validation exception with an error message only.
      Parameters:
      message - the error message
    • DataValidationException

      public DataValidationException(String message, Throwable cause)
      Creates a new validation exception with an error message and error cause
      Parameters:
      message - the error message
      cause - the cause of the error
    • DataValidationException

      public DataValidationException(String message, Object[] row)
      Creates a new validation exception with an error message and the row that could not be validated.
      Parameters:
      message - the error message
      row - the row that could not be processed.
    • DataValidationException

      public DataValidationException(String message, Object[] row, Throwable cause)
      Creates a new validation exception with an error message, the row that could not be validated, and the error cause.
      Parameters:
      message - the error message
      row - the row that could not be processed.
      cause - the cause of the error
    • DataValidationException

      public DataValidationException(String message, int columnIndex)
      Creates a new validation exception with an error message and the column that could not be validated.
      Parameters:
      message - the error message
      columnIndex - index of the column that could not be validated.
  • Method Details

    • getErrorDescription

      protected String getErrorDescription()
      Returns a generic description of the error. The result of this method is used by Throwable.getMessage() to print out a general description of the error before a detailed message of the root cause.
      Overrides:
      getErrorDescription in class DataProcessingException
      Returns:
      a generic description of the error.
    • getMessage

      public final String getMessage()
      Returns a detailed message describing the error, and the internal state of the parser/writer.
      Overrides:
      getMessage in class Throwable
      Returns:
      a detailed message describing the error
    • printIfNotEmpty

      protected static String printIfNotEmpty(String previous, String description, Object o)
    • restrictContent

      public static String restrictContent(int errorContentLength, CharSequence content)
    • restrictContent

      public static Object[] restrictContent(int errorContentLength, Object[] content)
    • setErrorContentLength

      public void setErrorContentLength(int errorContentLength)
    • restrictContent

      protected String restrictContent(CharSequence content)
    • restrictContent

      protected String restrictContent(Object content)
    • restrictContent

      protected Object[] restrictContent(Object[] content)