Package com.univocity.parsers.common
Class TextParsingException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.univocity.parsers.common.AbstractException
com.univocity.parsers.common.TextParsingException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DataProcessingException
Exception type used provide information about any issue that might happen while parsing from a given input.
It generally provides location information about where in the input a parsing error occurred.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate intprivate Stringprotected int[]private String[]private longprivate longprivate static final longFields inherited from class com.univocity.parsers.common.AbstractException
errorContentLength -
Constructor Summary
ConstructorsConstructorDescriptionTextParsingException(Context context, String message, 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, String message) Creates a new exception with information about an error that occurred when parsing some input.TextParsingException(ParsingContext context, Throwable cause) Creates a new exception with information about an error that occurred when parsing some input. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the location of the last character read from before the error occurred.intReturns the column index where the exception occurred.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.final String[]Returns the headers processed from the input, if any.longReturns the line number where the exception occurred.final StringReturns the last chunk of content parsed before the error took placelongReturns the record number when the exception occurred.protected voidsetContext(Context context) private voidsetParsingContext(ParsingContext parsingContext) Methods inherited from class com.univocity.parsers.common.AbstractException
getMessage, printIfNotEmpty, restrictContent, restrictContent, restrictContent, restrictContent, restrictContent, setErrorContentLength, updateMessageMethods 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:
-
lineIndex
private long lineIndex -
charIndex
private long charIndex -
recordNumber
private long recordNumber -
columnIndex
private int columnIndex -
-
headers
-
extractedIndexes
protected int[] extractedIndexes
-
-
Constructor Details
-
TextParsingException
Creates a new exception with information about an error that occurred when parsing some input.- Parameters:
context- the context of the parser when an error occurredmessage- message with details about the errorcause- the cause of the error
-
TextParsingException
Creates a new exception with information about an error that occurred when parsing some input.- Parameters:
context- the context of the parser when an error occurredmessage- message with details about the error
-
TextParsingException
Creates a new exception with information about an error that occurred when parsing some input.- Parameters:
context- the context of the parser when an error occurredcause- the cause of the error
-
TextParsingException
Creates a new exception with information about an error that occurred when parsing some input.- Parameters:
context- the context of the parser when an error occurred
-
-
Method Details
-
setContext
-
setParsingContext
-
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.- Specified by:
getErrorDescriptionin classAbstractException- 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.- Specified by:
getDetailsin classAbstractException- Returns:
- a String describing the internal state of the parser/writer.
-
getRecordNumber
public long getRecordNumber()Returns the record number when the exception occurred.- Returns:
- the record number when the exception occurred.
-
getColumnIndex
public int getColumnIndex()Returns the column index where the exception occurred.- Returns:
- the column index where the exception occurred.
-
getLineIndex
public long getLineIndex()Returns the line number where the exception occurred.- Returns:
- the line number where the exception occurred.
-
getCharIndex
public long getCharIndex()Returns the location of the last character read from before the error occurred.- Returns:
- the location of the last character read from before the error occurred.
-
getParsedContent
Returns the last chunk of content parsed before the error took place- Returns:
- the last chunk of content parsed before the error took place
-
getHeaders
Returns the headers processed from the input, if any.- Returns:
- the headers processed from the input, if any.
-