You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rodolfo Duldulao (JIRA)" <ji...@apache.org> on 2016/09/08 07:14:21 UTC

[jira] [Comment Edited] (CSV-195) Parser iterates over the last CSV Record twice.

    [ https://issues.apache.org/jira/browse/CSV-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15473016#comment-15473016 ] 

Rodolfo Duldulao edited comment on CSV-195 at 9/8/16 7:13 AM:
--------------------------------------------------------------

Output goes:
{code}
Processing 2
Processing 3
Processing 4
Processing 5
<Processing 6...25>
Processing 26
Processing 27
Processing 27   <-- repeated?
{code}


was (Author: rnduldulaojr@gmail.com):
Output goes:
Processing 2
Processing 3
Processing 4
Processing 5
<Processing 6...25>
Processing 26
Processing 27
Processing 27   <-- repeated?

> Parser iterates over the last CSV Record twice.
> -----------------------------------------------
>
>                 Key: CSV-195
>                 URL: https://issues.apache.org/jira/browse/CSV-195
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.4
>         Environment: Mac OS X 10.10.5
>            Reporter: Rodolfo Duldulao
>
> {code:java}
> class CSVParserSpecification extends Specification {
>    def "TEst CSVParser"() {
>       setup:
>          URL url = new URL("https://....../csv_with_28_lines_header_plus_ 27_records");
>          BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
>          def CSVParser parser = CSVFormat.RFC4180.withFirstRecordAsHeader().withIgnoreEmptyLines().withTrim().parse(reader);
>       when:
>          def count = 0
>          for (CSVRecord record: parser)
>             { println("Processing " + parser.getCurrentLineNumber()) count++ }
>          println(count);
>          parser.close()
>       then:
>          count == 27
>    }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)