Class TextParsingException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    DataProcessingException

    public class TextParsingException
    extends AbstractException
    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:
    Serialized Form
    • Field Detail

      • lineIndex

        private long lineIndex
      • charIndex

        private long charIndex
      • recordNumber

        private long recordNumber
      • columnIndex

        private int columnIndex
      • content

        private java.lang.String content
      • headers

        private java.lang.String[] headers
      • extractedIndexes

        protected int[] extractedIndexes
    • Constructor Detail

      • TextParsingException

        public 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.
        Parameters:
        context - the context of the parser when an error occurred
        message - message with details about the error
        cause - the cause of the error
      • TextParsingException

        public TextParsingException​(ParsingContext context,
                                    java.lang.String message)
        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
        message - message with details about the error
      • TextParsingException

        public TextParsingException​(ParsingContext context,
                                    java.lang.Throwable cause)
        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
        cause - the cause of the error
      • TextParsingException

        public TextParsingException​(ParsingContext context)
        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 Detail

      • setContext

        protected void setContext​(Context context)
      • setParsingContext

        private void setParsingContext​(ParsingContext parsingContext)
      • getErrorDescription

        protected java.lang.String getErrorDescription()
        Description copied from class: AbstractException
        Returns a generic description of the error. The result of this method is used by AbstractException.getMessage() to print out a general description of the error before a detailed message of the root cause.
        Specified by:
        getErrorDescription in class AbstractException
        Returns:
        a generic description of the error.
      • 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

        public final java.lang.String 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

        public final java.lang.String[] getHeaders()
        Returns the headers processed from the input, if any.
        Returns:
        the headers processed from the input, if any.