Package com.univocity.parsers.common
Class DataProcessingException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.univocity.parsers.common.AbstractException
com.univocity.parsers.common.TextParsingException
com.univocity.parsers.common.DataProcessingException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DataValidationException
A
DataProcessingException is an error thrown during the processing of a record successfully parsed.
This type of error usually indicates that the input text has been parsed correctly, but the subsequent
transformations applied over the input (generally via a RowProcessor} failed.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate Stringprivate Stringprivate booleanprivate booleanprivate Object[]private static final longprivate ObjectFields inherited from class com.univocity.parsers.common.TextParsingException
extractedIndexesFields inherited from class com.univocity.parsers.common.AbstractException
errorContentLength -
Constructor Summary
ConstructorsConstructorDescriptionDataProcessingException(String message) Creates a new exception with an error message only.DataProcessingException(String message, int columnIndex) Creates a new exception with an error message and the column that could not be processed.DataProcessingException(String message, int columnIndex, Object[] row, Throwable cause) Creates a new exception with an error message, the column that could not be processed the row that could not be processed, and the error cause.DataProcessingException(String message, Object[] row) Creates a new exception with an error message and the row that could not be processed.DataProcessingException(String message, Object[] row, Throwable cause) Creates a new exception with an error message, the row that could not be processed, and the error cause.DataProcessingException(String message, Throwable cause) Creates a new exception with an error message and error cause -
Method Summary
Modifier and TypeMethodDescriptionfinal intReturns the index of the column from where the error occurred, if available.Returns the name of the column from where the error occurred, if available.protected StringSubclasses must implement this method to return as much information as possible about the internal state of the parser/writer.protected StringReturns a generic description of the error.private intfinal Object[]getRow()Returns the record being processed when the error occurred, if available.final ObjectgetValue()Returns the value being processed when the error occurred, if available.(package private) final booleanisFatal()Returns a flag indicating whether this error is fatal and the process must stop as it is impossible to proceed.booleanReturns a flag indicating this exception has been handled by a user-providedProcessorErrorHandlerfinal voidmarkAsHandled(ProcessorErrorHandler handler) Marks the error as handled so it doesn't trigger aProcessorErrorHandleragain.final voidMarks the error as non fatal and the parsing process might proceed.final voidsetColumnIndex(int columnIndex) Defines the column index being processed when the error occurred.final voidsetColumnName(String columnName) Defines the name of the column being processed when the error occurred.voidsetDetails(String details) final voidUpdates the exception with the record being processed when the error occurred.final voidDefines the value being processed when the error occurred.final voidAssociates a label in the exception message (idenfied in curly braces) with a value being processed when the error occurred.protected final StringupdateMessage(String msg) Allows subclasses to alter the exception message that should be displayed to end users.Methods inherited from class com.univocity.parsers.common.TextParsingException
getCharIndex, getHeaders, getLineIndex, getParsedContent, getRecordNumber, setContextMethods inherited from class com.univocity.parsers.common.AbstractException
getMessage, printIfNotEmpty, restrictContent, restrictContent, restrictContent, restrictContent, restrictContent, setErrorContentLengthMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
columnName
-
columnIndex
private int columnIndex -
row
-
value
-
values
-
fatal
private boolean fatal -
handled
private boolean handled -
details
-
-
Constructor Details
-
DataProcessingException
Creates a new exception with an error message only.- Parameters:
message- the error message
-
DataProcessingException
Creates a new exception with an error message and error cause- Parameters:
message- the error messagecause- the cause of the error
-
DataProcessingException
Creates a new exception with an error message and the row that could not be processed.- Parameters:
message- the error messagerow- the row that could not be processed.
-
DataProcessingException
Creates a new exception with an error message, the row that could not be processed, and the error cause.- Parameters:
message- the error messagerow- the row that could not be processed.cause- the cause of the error
-
DataProcessingException
Creates a new exception with an error message and the column that could not be processed.- Parameters:
message- the error messagecolumnIndex- index of the column that could not be processed.
-
DataProcessingException
Creates a new exception with an error message, the column that could not be processed the row that could not be processed, and the error cause.- Parameters:
message- the error messagecolumnIndex- index of the column that could not be processed.row- the row that could not be processed.cause- the cause of the error
-
-
Method Details
-
getErrorDescription
Description copied from class:AbstractExceptionReturns a generic description of the error. The result of this method is used byAbstractException.getMessage()to print out a general description of the error before a detailed message of the root cause.- Overrides:
getErrorDescriptionin classTextParsingException- Returns:
- a generic description of the error.
-
getDetails
Description copied from class:AbstractExceptionSubclasses must implement this method to return as much information as possible about the internal state of the parser/writer. UseAbstractException.printIfNotEmpty(String, String, Object)to create a comma-separated list of relevant properties and their (non null) values. The result of this method is used by theAbstractException.getMessage()method to print out these details after the error message.- Overrides:
getDetailsin classTextParsingException- Returns:
- a String describing the internal state of the parser/writer.
-
getColumnName
Returns the name of the column from where the error occurred, if available.- Returns:
- the name of the column from where the error occurred.
-
getColumnIndex
public final int getColumnIndex()Returns the index of the column from where the error occurred, if available.- Overrides:
getColumnIndexin classTextParsingException- Returns:
- the index of the column from where the error occurred.
-
getRow
Returns the record being processed when the error occurred, if available.- Returns:
- the record being processed when error occurred, if available.
-
setValue
Defines the value being processed when the error occurred.- Parameters:
value- the value being processed when error occurred.
-
setValue
Associates a label in the exception message (idenfied in curly braces) with a value being processed when the error occurred. Used for formatting the exception message- Parameters:
label- a label in the exception message - any string enclosed by curly braces.value- the value being processed when error occurred, that should be replaced by the label in the exception message.
-
getValue
Returns the value being processed when the error occurred, if available.- Returns:
- the value being processed when the error occurred, if available.
-
setColumnIndex
public final void setColumnIndex(int columnIndex) Defines the column index being processed when the error occurred.- Parameters:
columnIndex- the column index being processed when error occurred.
-
getExtractedColumnIndex
private int getExtractedColumnIndex() -
setColumnName
Defines the name of the column being processed when the error occurred.- Parameters:
columnName- the name of the column being processed when error occurred.
-
setRow
Updates the exception with the record being processed when the error occurred.- Parameters:
row- the record data processed when the error occurred.
-
isFatal
final boolean isFatal()Returns a flag indicating whether this error is fatal and the process must stop as it is impossible to proceed.- Returns:
- a flag indicating whether this error is fatal and the process must stop as it is impossible to proceed.
-
markAsNonFatal
public final void markAsNonFatal()Marks the error as non fatal and the parsing process might proceed. -
markAsHandled
Marks the error as handled so it doesn't trigger aProcessorErrorHandleragain.- Parameters:
handler- theProcessorErrorHandlerused to handle this exception.
-
isHandled
public boolean isHandled()Returns a flag indicating this exception has been handled by a user-providedProcessorErrorHandler- Returns:
trueif this exception has been handled to a user-providedProcessorErrorHandler, otherwisefalse
-
setDetails
-
updateMessage
Description copied from class:AbstractExceptionAllows subclasses to alter the exception message that should be displayed to end users. By default the original message is kept unchanged.- Overrides:
updateMessagein classAbstractException- Parameters:
msg- the original message- Returns:
- the updated message.
-