Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.4
-
None
-
None
Description
I can format CSV using CSVFormat that is subsequently unparsable by CSVFormat, the test below illustrates the failure:
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()); } } }