Class CsvParseException

All Implemented Interfaces:
OpenExceptionMeta, Serializable

public class CsvParseException extends OpenCsvException
CSV Parse Exception - Exception for CSV parsing errors CSV解析异常 - CSV解析错误异常

Thrown when CSV content cannot be parsed due to syntax errors such as unclosed quotes, invalid escaping, or malformed records. Carries the problematic line content for diagnostics.

当CSV内容因语法错误(如未关闭的引号、无效转义或畸形记录)而无法解析时抛出。 携带有问题的行内容用于诊断。

Usage Examples | 使用示例:

throw CsvParseException.of("Unclosed quote", 5, 23, "field1,\"unclosed");

Security | 安全性:

  • Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
Since:
JDK 25, opencode-base-csv V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • CsvParseException

      public CsvParseException(String message, int line, int column, String lineContent)
      Constructs a parse exception with all details 构造带所有详细信息的解析异常
      Parameters:
      message - the detail message | 详细消息
      line - the line number | 行号
      column - the column number | 列号
      lineContent - the problematic line content | 有问题的行内容
    • CsvParseException

      public CsvParseException(String message, int line, int column, String lineContent, Throwable cause)
      Constructs a parse exception with all details and cause 构造带所有详细信息和原因的解析异常
      Parameters:
      message - the detail message | 详细消息
      line - the line number | 行号
      column - the column number | 列号
      lineContent - the problematic line content | 有问题的行内容
      cause - the cause | 原因
  • Method Details

    • getLineContent

      public String getLineContent()
      Gets the content of the problematic line 获取有问题的行内容
      Returns:
      the line content, or null if not available | 行内容,如果不可用则为null
    • of

      public static CsvParseException of(String message, int line, int column, String lineContent)
      Creates a parse exception with location and line content 创建带位置和行内容的解析异常
      Parameters:
      message - the error message | 错误消息
      line - the line number | 行号
      column - the column number | 列号
      lineContent - the problematic line content | 有问题的行内容
      Returns:
      the exception | 异常