[
https://issues.apache.org/jira/browse/CSV-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15473620#comment-15473620
]
Rodolfo Duldulao commented on CSV-195:
--------------------------------------
I saved the file locally (not from a URL) and tried to parse it. I still got
the same behavior. It still had the same effect, Record #27 was iterated over
twice.
I modified the data file by adding a new blank line at the end of the file and
it was able to process it correctly, no going over a record twice.
Is there a method that I needed to call to get over this behavior? I tried
CSVFormat.EXCEL over the original file and it still went over the last line
twice.
> 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
> Fix For: Patch Needed
>
>
> {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)