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:
Serializable
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 Summary
FieldsFields inherited from class com.univocity.parsers.common.TextParsingException
extractedIndexes
-
Constructor Summary
ConstructorsConstructorDescriptionDataValidationException
(String message) Creates a new validation exception with an error message only.DataValidationException
(String message, int columnIndex) Creates a new validation exception with an error message and the column that could not be validated.DataValidationException
(String message, Object[] row) Creates a new validation exception with an error message and the row that could not be validated.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.DataValidationException
(String message, Throwable cause) Creates a new validation exception with an error message and error cause -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Returns a generic description of the error.final String
Returns a detailed message describing the error, and the internal state of the parser/writer.protected static String
printIfNotEmpty
(String previous, String description, Object o) static String
restrictContent
(int errorContentLength, CharSequence content) static Object[]
restrictContent
(int errorContentLength, Object[] content) protected String
restrictContent
(CharSequence content) protected String
restrictContent
(Object content) protected Object[]
restrictContent
(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
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
errorContentLength
protected int errorContentLength
-
-
Constructor Details
-
DataValidationException
Creates a new validation exception with an error message only.- Parameters:
message
- the error message
-
DataValidationException
Creates a new validation exception with an error message and error cause- Parameters:
message
- the error messagecause
- the cause of the error
-
DataValidationException
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
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
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 Details
-
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
Returns a detailed message describing the error, and the internal state of the parser/writer.- Overrides:
getMessage
in classThrowable
- Returns:
- a detailed message describing the error
-
printIfNotEmpty
-
restrictContent
-
restrictContent
-
setErrorContentLength
public void setErrorContentLength(int errorContentLength) -
restrictContent
-
restrictContent
-
restrictContent
-