Package com.univocity.parsers.common
Class DataValidationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.univocity.parsers.common.TextParsingException
-
- com.univocity.parsers.common.DataProcessingException
-
- com.univocity.parsers.common.DataValidationException
-
- All Implemented Interfaces:
java.io.Serializable
public class DataValidationException extends DataProcessingException
ADataValidationException
is an error thrown during the processing of a record successfully parsed, but whose data failed to pass a validation defined by annotationValidate
- Author:
- Univocity Software Pty Ltd - parsers@univocity.com
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
errorContentLength
-
Fields inherited from class com.univocity.parsers.common.TextParsingException
extractedIndexes
-
-
Constructor Summary
Constructors Constructor Description DataValidationException(java.lang.String message)
Creates a new validation exception with an error message only.DataValidationException(java.lang.String message, int columnIndex)
Creates a new validation exception with an error message and the column that could not be validated.DataValidationException(java.lang.String message, java.lang.Object[] row)
Creates a new validation exception with an error message and the row that could not be validated.DataValidationException(java.lang.String message, java.lang.Object[] row, java.lang.Throwable cause)
Creates a new validation exception with an error message, the row that could not be validated, and the error cause.DataValidationException(java.lang.String message, java.lang.Throwable cause)
Creates a new validation exception with an error message and error cause
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getErrorDescription()
Returns a generic description of the error.java.lang.String
getMessage()
Returns a detailed message describing the error, and the internal state of the parser/writer.protected static java.lang.String
printIfNotEmpty(java.lang.String previous, java.lang.String description, java.lang.Object o)
static java.lang.String
restrictContent(int errorContentLength, java.lang.CharSequence content)
static java.lang.Object[]
restrictContent(int errorContentLength, java.lang.Object[] content)
protected java.lang.String
restrictContent(java.lang.CharSequence content)
protected java.lang.String
restrictContent(java.lang.Object content)
protected java.lang.Object[]
restrictContent(java.lang.Object[] content)
void
setErrorContentLength(int errorContentLength)
-
Methods inherited from class com.univocity.parsers.common.DataProcessingException
getColumnIndex, getColumnName, getDetails, getRow, getValue, isHandled, markAsHandled, markAsNonFatal, setColumnIndex, setColumnName, setDetails, setRow, setValue, setValue, updateMessage
-
Methods inherited from class com.univocity.parsers.common.TextParsingException
getCharIndex, getHeaders, getLineIndex, getParsedContent, getRecordNumber, setContext
-
-
-
-
Constructor Detail
-
DataValidationException
public DataValidationException(java.lang.String message)
Creates a new validation exception with an error message only.- Parameters:
message
- the error message
-
DataValidationException
public DataValidationException(java.lang.String message, java.lang.Throwable cause)
Creates a new validation exception with an error message and error cause- Parameters:
message
- the error messagecause
- the cause of the error
-
DataValidationException
public DataValidationException(java.lang.String message, java.lang.Object[] row)
Creates a new validation exception with an error message and the row that could not be validated.- Parameters:
message
- the error messagerow
- the row that could not be processed.
-
DataValidationException
public DataValidationException(java.lang.String message, java.lang.Object[] row, java.lang.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 messagerow
- the row that could not be processed.cause
- the cause of the error
-
DataValidationException
public DataValidationException(java.lang.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 messagecolumnIndex
- index of the column that could not be validated.
-
-
Method Detail
-
getErrorDescription
protected java.lang.String getErrorDescription()
Returns a generic description of the error. The result of this method is used byThrowable.getMessage()
to print out a general description of the error before a detailed message of the root cause.- Overrides:
getErrorDescription
in classDataProcessingException
- Returns:
- a generic description of the error.
-
getMessage
public final java.lang.String getMessage()
Returns a detailed message describing the error, and the internal state of the parser/writer.- Overrides:
getMessage
in classjava.lang.Throwable
- Returns:
- a detailed message describing the error
-
printIfNotEmpty
protected static java.lang.String printIfNotEmpty(java.lang.String previous, java.lang.String description, java.lang.Object o)
-
restrictContent
public static java.lang.String restrictContent(int errorContentLength, java.lang.CharSequence content)
-
restrictContent
public static java.lang.Object[] restrictContent(int errorContentLength, java.lang.Object[] content)
-
setErrorContentLength
public void setErrorContentLength(int errorContentLength)
-
restrictContent
protected java.lang.String restrictContent(java.lang.CharSequence content)
-
restrictContent
protected java.lang.String restrictContent(java.lang.Object content)
-
restrictContent
protected java.lang.Object[] restrictContent(java.lang.Object[] content)
-
-