[
https://issues.apache.org/jira/browse/CSV-249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved CSV-249.
---------------------------------
Fix Version/s: 1.8
Resolution: Not A Problem
I cannot reproduce this in 1.8-SNAPSHOT with the new test
{{org.apache.commons.csv.issues.JiraCvs249Test}}. Please verify and close.
> ArrayIndexOutOfBoundsException when trying to read record written by
> CSVPrinter using CSVParser with same format
> ----------------------------------------------------------------------------------------------------------------
>
> Key: CSV-249
> URL: https://issues.apache.org/jira/browse/CSV-249
> Project: Commons CSV
> Issue Type: Bug
> Components: Parser
> Affects Versions: 1.5, 1.6, 1.7
> Reporter: Jelmer Vernooij
> Priority: Major
> Fix For: 1.8
>
>
> The following code will fail with the exceptionÂ
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1
> out of bounds for length 1
> {noformat}
> import org.apache.commons.csv.*;
> import java.io.StringReader;
> import java.io.StringWriter;
> import java.util.List;
> public class Poc {
> public static void main(String[] args) throws Exception {
> CSVFormat csvFormat = CSVFormat.DEFAULT
> .withEscape('\\');
> StringWriter stringWriter = new StringWriter();
> CSVPrinter printer = new CSVPrinter(stringWriter, csvFormat);
> printer.printRecord("foo \\", "bar");
> StringReader stringReader = new StringReader(stringWriter.toString());
> CSVParser parser = new CSVParser(stringReader, csvFormat);
> List<CSVRecord> records = parser.getRecords();
> records.forEach(record -> {
> System.out.println(record.get(0));
> System.out.println(record.get(1));
> });
> }
> }{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)