Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1610F9723 for ; Mon, 5 Mar 2012 11:30:22 +0000 (UTC) Received: (qmail 72711 invoked by uid 500); 5 Mar 2012 11:30:21 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 72602 invoked by uid 500); 5 Mar 2012 11:30: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 72548 invoked by uid 99); 5 Mar 2012 11:30:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2012 11:30:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2012 11:30:19 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 5CB6E9CE4 for ; Mon, 5 Mar 2012 11:29:57 +0000 (UTC) Date: Mon, 5 Mar 2012 11:29:57 +0000 (UTC) From: "Emmanuel Bourg (Commented) (JIRA)" To: issues@commons.apache.org Message-ID: <1956810465.22003.1330946997381.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1557009252.21825.1330940037828.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (SANDBOX-406) CSV Parser loops inifinitely if last line starts with a comment char MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SANDBOX-406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13222279#comment-13222279 ] Emmanuel Bourg commented on SANDBOX-406: ---------------------------------------- Thank you for the report Edgar. This issue seems specific to the SOLR version of Commons CSV, I ran this test on the current version of Commons CSV on the trunk and it worked fine: {code} StringReader input = new StringReader("# Comment 1\na,b,c\n# Comment 2"); CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#'); for (String[] line : new CSVParser(input, format)) { System.out.println("Line: " + Arrays.toString(line)); } {code} Could you do another test with this artefact instead? This is a more recent version, you'll have to change your code slightly, the CSVStrategy class has been renamed to CSVFormat. {code} org.apache.commons commons-csv 1.0-SNAPSHOT {code} This artifact is located in the Apache snapshot repository at http://repository.apache.org/snapshots > CSV Parser loops inifinitely if last line starts with a comment char > -------------------------------------------------------------------- > > Key: SANDBOX-406 > URL: https://issues.apache.org/jira/browse/SANDBOX-406 > Project: Commons Sandbox > Issue Type: Bug > Components: CSV > Reporter: Edgar Philipp > > Behaviour: > Whenever the last non-empty line of the CSV file starts with a comment, the CSVParser loops infinitely! > Examplary CSV file: > {code} > some > # comment OK > line > # comment OK > value > # problematic comment > {code} > Excerpt of Java code: > {code:java} > private static final char COMMENT = '#'; > private static final char QUOTE = '"'; > private static final char SEPARATOR = ';'; > CSVStrategy csvStrategy = new CSVStrategy(SEPARATOR, QUOTE, COMMENT); > CSVParser parser = new CSVParser(reader, csvStrategy); > String[] line = parser.getLine(); > while (line != null) { > Log.debug("Line: " + line[0]); > // Do something > line = parser.getLine(); > } > {code} > Used Maven Dependency: > {code:xml} > > org.apache.solr > solr-commons-csv > 1.4.0 > > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira