Vladimir Eatwell created CSV-200:
------------------------------------
Summary: CSVFormat cannot read its own output if input contain
escape character followed by quote character
Key: CSV-200
URL: https://issues.apache.org/jira/browse/CSV-200
Project: Commons CSV
Issue Type: Bug
Components: Parser
Affects Versions: 1.4
Reporter: Vladimir Eatwell
I can format CSV using CSVFormat that is subsequently unparsable by CSVFormat,
the test below illustrates the failure:
{code}
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.csv.QuoteMode;
import org.junit.Test;
import java.io.StringReader;
import java.util.List;
public class CSVFormatTest {
@Test
public void parseFailure() throws Exception {
CSVFormat formatter = CSVFormat.DEFAULT;
formatter = formatter.withDelimiter(',');
formatter = formatter.withQuote('*');
formatter = formatter.withEscape('/');
formatter = formatter.withNullString("NULL");
formatter = formatter.withIgnoreSurroundingSpaces(true);
formatter = formatter.withQuoteMode(QuoteMode.MINIMAL);
String formatted = formatter.format("bob/*", "token");
List<CSVRecord> parsed = formatter.parse(new
StringReader(formatted)).getRecords();
for (CSVRecord record : parsed) {
System.out.println(record.size());
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)