public class DataProcessingException extends TextParsingException
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.Modifier and Type | Field and Description |
---|---|
protected int |
errorContentLength |
extractedIndexes
Constructor and Description |
---|
DataProcessingException(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
|
Modifier and Type | Method and Description |
---|---|
int |
getColumnIndex()
Returns the index of the column from where the error occurred, if available.
|
String |
getColumnName()
Returns the name of the column from where the error occurred, if available.
|
protected String |
getDetails()
Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer.
|
protected String |
getErrorDescription()
Returns a generic description of the error.
|
String |
getMessage()
Returns a detailed message describing the error, and the internal state of the parser/writer.
|
Object[] |
getRow()
Returns the record being processed when the error occurred, if available.
|
Object |
getValue()
Returns the value being processed when the error occurred, if available.
|
boolean |
isHandled()
Returns a flag indicating this exception has been handled by a user-provided
ProcessorErrorHandler |
void |
markAsHandled(ProcessorErrorHandler handler)
Marks the error as handled so it doesn't trigger a
ProcessorErrorHandler again. |
void |
markAsNonFatal()
Marks the error as non fatal and the parsing process might proceed.
|
protected static String |
printIfNotEmpty(String previous,
String description,
Object o) |
protected String |
restrictContent(CharSequence content) |
static String |
restrictContent(int errorContentLength,
CharSequence content) |
static Object[] |
restrictContent(int errorContentLength,
Object[] content) |
protected String |
restrictContent(Object content) |
protected Object[] |
restrictContent(Object[] content) |
void |
setColumnIndex(int columnIndex)
Defines the column index being processed when the error occurred.
|
void |
setColumnName(String columnName)
Defines the name of the column being processed when the error occurred.
|
void |
setDetails(String details) |
void |
setErrorContentLength(int errorContentLength) |
void |
setRow(Object[] row)
Updates the exception with the record being processed when the error occurred.
|
void |
setValue(Object value)
Defines the value being processed when the error occurred.
|
void |
setValue(String label,
Object value)
Associates a label in the exception message (idenfied in curly braces) with a value being processed when the error occurred.
|
protected String |
updateMessage(String msg)
Allows subclasses to alter the exception message that should be displayed to end users.
|
getCharIndex, getHeaders, getLineIndex, getParsedContent, getRecordNumber, setContext
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public DataProcessingException(String message)
message
- the error messagepublic DataProcessingException(String message, Throwable cause)
message
- the error messagecause
- the cause of the errorpublic DataProcessingException(String message, Object[] row)
message
- the error messagerow
- the row that could not be processed.public DataProcessingException(String message, Object[] row, Throwable cause)
message
- the error messagerow
- the row that could not be processed.cause
- the cause of the errorpublic DataProcessingException(String message, int columnIndex)
message
- the error messagecolumnIndex
- index of the column that could not be processed.public DataProcessingException(String message, int columnIndex, Object[] row, Throwable cause)
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 errorprotected String getErrorDescription()
getMessage()
to print out a general description of the error before a detailed message of the root cause.getErrorDescription
in class TextParsingException
protected String getDetails()
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 the getMessage()
method to print out these details after the error message.getDetails
in class TextParsingException
public String getColumnName()
public final int getColumnIndex()
getColumnIndex
in class TextParsingException
public final Object[] getRow()
public final void setValue(Object value)
value
- the value being processed when error occurred.public final void setValue(String label, Object value)
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.public final Object getValue()
public final void setColumnIndex(int columnIndex)
columnIndex
- the column index being processed when error occurred.public final void setColumnName(String columnName)
columnName
- the name of the column being processed when error occurred.public final void setRow(Object[] row)
row
- the record data processed when the error occurred.public final void markAsNonFatal()
public final void markAsHandled(ProcessorErrorHandler handler)
ProcessorErrorHandler
again.handler
- the ProcessorErrorHandler
used to handle this exception.public boolean isHandled()
ProcessorErrorHandler
true
if this exception has been handled to a user-provided ProcessorErrorHandler
,
otherwise false
public void setDetails(String details)
protected final String updateMessage(String msg)
msg
- the original messagepublic final String getMessage()
getMessage
in class Throwable
protected static String printIfNotEmpty(String previous, String description, Object o)
public static String restrictContent(int errorContentLength, CharSequence content)
public void setErrorContentLength(int errorContentLength)
protected String restrictContent(CharSequence content)
Copyright © 2019 Univocity Software Pty Ltd. All rights reserved.