Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 78329200B7C for ; Thu, 8 Sep 2016 14:18:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 76E76160ABD; Thu, 8 Sep 2016 12:18:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BE81F160AA5 for ; Thu, 8 Sep 2016 14:18:22 +0200 (CEST) Received: (qmail 85777 invoked by uid 500); 8 Sep 2016 12:18:21 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 85762 invoked by uid 99); 8 Sep 2016 12:18:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Sep 2016 12:18:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id BA23B2C1B79 for ; Thu, 8 Sep 2016 12:18:21 +0000 (UTC) Date: Thu, 8 Sep 2016 12:18:21 +0000 (UTC) From: "Michael Vitz (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CSV-195) Parser iterates over the last CSV Record twice. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 08 Sep 2016 12:18:23 -0000 [ https://issues.apache.org/jira/browse/CSV-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15473711#comment-15473711 ] Michael Vitz commented on CSV-195: ---------------------------------- After some digging I think that the record isn't processed twice. The test is green (processes exactly 27 records) but prints 'Processing 27' twice. My best guess is that the implementation of 'getCurrentLineNumber' has a bug when the last record isn't ended with a CR or LF but an EOF. > 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 > > Attachments: whitelist.csv > > > {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)