diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/TextAndCSVParser.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/TextAndCSVParser.java index 1f565d77f3..8feb63e1fb 100644 --- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/TextAndCSVParser.java +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/TextAndCSVParser.java @@ -32,6 +32,7 @@ import java.util.Set; import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; import org.apache.commons.io.input.CloseShieldInputStream; import org.xml.sax.ContentHandler; @@ -179,13 +180,12 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata, return; } - CSVFormat csvFormat = CSVFormat.EXCEL.builder().setDelimiter(params.getDelimiter()).build(); + CSVFormat csvFormat = CSVFormat.EXCEL.builder().setDelimiter(params.getDelimiter()).get(); metadata.set(DELIMITER_PROPERTY, textAndCSVConfig.getDelimiterToNameMap().get(csvFormat.getDelimiterString().charAt(0))); XHTMLContentHandler xhtmlContentHandler = new XHTMLContentHandler(handler, metadata); int totalRows = 0; - try (org.apache.commons.csv.CSVParser commonsParser = new org.apache.commons.csv.CSVParser( - reader, csvFormat)) { + try (CSVParser commonsParser = CSVParser.builder().setReader(reader).setFormat(csvFormat).get()) { xhtmlContentHandler.startDocument(); xhtmlContentHandler.startElement(TABLE); int firstRowColCount = 0;