DataProcessingException
public class TextParsingException
extends java.lang.RuntimeException
It generally provides location information about where in the input a parsing error occurred.
Modifier and Type | Field | Description |
---|---|---|
protected int |
errorContentLength |
|
protected int[] |
extractedIndexes |
Constructor | Description |
---|---|
TextParsingException(Context context,
java.lang.String message,
java.lang.Throwable cause) |
Creates a new exception with information about an error that occurred when parsing some input.
|
TextParsingException(ParsingContext context) |
Creates a new exception with information about an error that occurred when parsing some input.
|
TextParsingException(ParsingContext context,
java.lang.String message) |
Creates a new exception with information about an error that occurred when parsing some input.
|
TextParsingException(ParsingContext context,
java.lang.Throwable cause) |
Creates a new exception with information about an error that occurred when parsing some input.
|
Modifier and Type | Method | Description |
---|---|---|
long |
getCharIndex() |
Returns the location of the last character read from before the error occurred.
|
int |
getColumnIndex() |
Returns the column index where the exception occurred.
|
protected java.lang.String |
getDetails() |
Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer.
|
protected java.lang.String |
getErrorDescription() |
Returns a generic description of the error.
|
java.lang.String[] |
getHeaders() |
Returns the headers processed from the input, if any.
|
long |
getLineIndex() |
Returns the line number where the exception occurred.
|
java.lang.String |
getMessage() |
Returns a detailed message describing the error, and the internal state of the parser/writer.
|
java.lang.String |
getParsedContent() |
Returns the last chunk of content parsed before the error took place
|
long |
getRecordNumber() |
Returns the record number when the exception occurred.
|
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) |
|
protected void |
setContext(Context context) |
|
void |
setErrorContentLength(int errorContentLength) |
|
protected java.lang.String |
updateMessage(java.lang.String msg) |
Allows subclasses to alter the exception message that should be displayed to end users.
|
protected int[] extractedIndexes
protected int errorContentLength
public TextParsingException(Context context, java.lang.String message, java.lang.Throwable cause)
context
- the context of the parser when an error occurredmessage
- message with details about the errorcause
- the cause of the errorpublic TextParsingException(ParsingContext context, java.lang.String message)
context
- the context of the parser when an error occurredmessage
- message with details about the errorpublic TextParsingException(ParsingContext context, java.lang.Throwable cause)
context
- the context of the parser when an error occurredcause
- the cause of the errorpublic TextParsingException(ParsingContext context)
context
- the context of the parser when an error occurredprotected void setContext(Context context)
protected java.lang.String getErrorDescription()
getMessage()
to print out a general description of the error before a detailed message of the root cause.protected java.lang.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.public long getRecordNumber()
public int getColumnIndex()
public long getLineIndex()
public long getCharIndex()
public final java.lang.String getParsedContent()
public final java.lang.String[] getHeaders()
public final java.lang.String getMessage()
getMessage
in class java.lang.Throwable
protected java.lang.String updateMessage(java.lang.String msg)
msg
- the original messageprotected static java.lang.String printIfNotEmpty(java.lang.String previous, java.lang.String description, java.lang.Object o)
public static java.lang.String restrictContent(int errorContentLength, java.lang.CharSequence content)
public static java.lang.Object[] restrictContent(int errorContentLength, java.lang.Object[] content)
public void setErrorContentLength(int errorContentLength)
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)