[jira] [Commented] (CSV-288) String delimiter (||) is not working as expected.
[ https://issues.apache.org/jira/browse/CSV-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17604053#comment-17604053 ] Gary D. Gregory commented on CSV-288: - Hi.[~ss...@snaplogic.com] Hopefully in a month or so. > String delimiter (||) is not working as expected. > - > > Key: CSV-288 > URL: https://issues.apache.org/jira/browse/CSV-288 > Project: Commons CSV > Issue Type: Bug >Reporter: Santhsoh >Priority: Major > Fix For: 1.10.0 > > Time Spent: 40m > Remaining Estimate: 0h > > Steps to reproduce : > 1. Parse CSV file with || as delimiter and having empty columns > 2. Print the CSVRecord resulting from CSVParser > > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > public static void main(String[] args) throws Exception\{ > String row = "a||b||c||df||g"; > StringBuilder stringBuilder = new StringBuilder(); > try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, > CSVFormat.EXCEL); > CSVParser csvParser = CSVParser.parse(new StringInputStream(row), > StandardCharsets.UTF_8, > CSVFormat.Builder.create().setDelimiter("||").build())) { > for (CSVRecord csvRecord : csvParser) { > for (int i = 0; i < csvRecord.size(); i++) { > csvPrinter.print(csvRecord.get(i)); > } > System.out.println(stringBuilder.toString()); > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > } > } > } > With the snippet provided above, actual value is not same as expected value -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CSV-288) String delimiter (||) is not working as expected.
[ https://issues.apache.org/jira/browse/CSV-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17603917#comment-17603917 ] Sushma commented on CSV-288: [~ggregory] Can we know when 1.10.0 version will be officially released? > String delimiter (||) is not working as expected. > - > > Key: CSV-288 > URL: https://issues.apache.org/jira/browse/CSV-288 > Project: Commons CSV > Issue Type: Bug >Reporter: Santhsoh >Priority: Major > Fix For: 1.10.0 > > Time Spent: 40m > Remaining Estimate: 0h > > Steps to reproduce : > 1. Parse CSV file with || as delimiter and having empty columns > 2. Print the CSVRecord resulting from CSVParser > > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > public static void main(String[] args) throws Exception\{ > String row = "a||b||c||df||g"; > StringBuilder stringBuilder = new StringBuilder(); > try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, > CSVFormat.EXCEL); > CSVParser csvParser = CSVParser.parse(new StringInputStream(row), > StandardCharsets.UTF_8, > CSVFormat.Builder.create().setDelimiter("||").build())) { > for (CSVRecord csvRecord : csvParser) { > for (int i = 0; i < csvRecord.size(); i++) { > csvPrinter.print(csvRecord.get(i)); > } > System.out.println(stringBuilder.toString()); > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > } > } > } > With the snippet provided above, actual value is not same as expected value -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CSV-288) String delimiter (||) is not working as expected.
[ https://issues.apache.org/jira/browse/CSV-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17492428#comment-17492428 ] Angus C commented on CSV-288: - In below line in Lexar.java, the isDelimiter() unintentionally advance the buffer pointer and "eat" the first "|" when it comes to the "b" in "|b|" (lastChar is "|", nextChar is also "|", make it "||"). So "a||bc||d " doesn't fail (lastChar is "|", but next char is "c"), neither if the delimiter is two different char (e.g. |!). The checking is used to detect the last empty column (e.g. in "a,b,") {code:java} // did we reach eof during the last iteration already ? EOF if (isEndOfFile(lastChar) || !isDelimiter(lastChar) && isEndOfFile(c)) { {code} > String delimiter (||) is not working as expected. > - > > Key: CSV-288 > URL: https://issues.apache.org/jira/browse/CSV-288 > Project: Commons CSV > Issue Type: Bug >Reporter: Santhsoh >Priority: Major > > Steps to reproduce : > 1. Parse CSV file with || as delimiter and having empty columns > 2. Print the CSVRecord resulting from CSVParser > > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > public static void main(String[] args) throws Exception\{ > String row = "a||b||c||df||g"; > StringBuilder stringBuilder = new StringBuilder(); > try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, > CSVFormat.EXCEL); > CSVParser csvParser = CSVParser.parse(new StringInputStream(row), > StandardCharsets.UTF_8, > CSVFormat.Builder.create().setDelimiter("||").build())) { > for (CSVRecord csvRecord : csvParser) { > for (int i = 0; i < csvRecord.size(); i++) { > csvPrinter.print(csvRecord.get(i)); > } > System.out.println(stringBuilder.toString()); > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > } > } > } > With the snippet provided above, actual value is not same as expected value -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (CSV-288) String delimiter (||) is not working as expected.
[ https://issues.apache.org/jira/browse/CSV-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17410905#comment-17410905 ] Santhsoh commented on CSV-288: -- Failing test case : {code:java} org.apache.commons.csv.CSVParserTest#testParseWithDoublePipeDelimiter@Test public void testParseWithDoublePipeDelimiter() throws Exception { final Reader in = new StringReader("a||b||c||df"); StringBuilder stringBuilder = new StringBuilder(); try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, CSVFormat.EXCEL); CSVParser csvParser = CSVParser.parse(in, CSVFormat.Builder.create().setDelimiter("||").build())) { for (CSVRecord csvRecord : csvParser) { for (int i = 0; i < csvRecord.size(); i++) { csvPrinter.print(csvRecord.get(i)); } assertEquals("a,b,c,d,,f", stringBuilder.toString()); } } }{code} > String delimiter (||) is not working as expected. > - > > Key: CSV-288 > URL: https://issues.apache.org/jira/browse/CSV-288 > Project: Commons CSV > Issue Type: Bug >Reporter: Santhsoh >Priority: Major > > Steps to reproduce : > 1. Parse CSV file with || as delimiter and having empty columns > 2. Print the CSVRecord resulting from CSVParser > > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > public static void main(String[] args) throws Exception\{ > String row = "a||b||c||df||g"; > StringBuilder stringBuilder = new StringBuilder(); > try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, > CSVFormat.EXCEL); > CSVParser csvParser = CSVParser.parse(new StringInputStream(row), > StandardCharsets.UTF_8, > CSVFormat.Builder.create().setDelimiter("||").build())) { > for (CSVRecord csvRecord : csvParser) { > for (int i = 0; i < csvRecord.size(); i++) { > csvPrinter.print(csvRecord.get(i)); > } > System.out.println(stringBuilder.toString()); > //Expected : a,b,c,d,,f,g > // Actual : a,b|c,d,|f,g > } > } > } > With the snippet provided above, actual value is not same as expected value -- This message was sent by Atlassian Jira (v8.3.4#803005)