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 01AE911EF7 for ; Thu, 14 Aug 2014 20:08:45 +0000 (UTC) Received: (qmail 44504 invoked by uid 500); 14 Aug 2014 20:08:29 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 44423 invoked by uid 500); 14 Aug 2014 20:08:29 -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 44326 invoked by uid 99); 14 Aug 2014 20:08:28 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2014 20:08:28 +0000 Date: Thu, 14 Aug 2014 20:08:28 +0000 (UTC) From: "Benedikt Ritter (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (CSV-31) CSVParser hangs (goes into infinite loop) on getLine() if it's a "comment" line that doesn't contain a delimiter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CSV-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benedikt Ritter closed CSV-31. ------------------------------ > CSVParser hangs (goes into infinite loop) on getLine() if it's a "comment" line that doesn't contain a delimiter > ---------------------------------------------------------------------------------------------------------------- > > Key: CSV-31 > URL: https://issues.apache.org/jira/browse/CSV-31 > Project: Commons CSV > Issue Type: Bug > Components: Parser > Reporter: Toli Kuznets > Fix For: 1.0 > > > if you call CSVParser.getLine() or nextToken() with a line that is a comment as defined by the CSVStrategy but it doesn't contain the delimiter character, the call hangs in an infinite loop > This code will hang: > {code} > parser = new CSVParser(new StringReader("# abc\n"), new CSVStrategy('\t', '\'', '#')); > tokens = parser.getLine(); > {code} > However, if you insert a delimiter char into the incoming string, it'll come through and return an empty string as a result: > {code} > CSVParser parser = new CSVParser(new StringReader("#\tabc"), new CSVStrategy('\t', '\'', '#')); > String[] tokens = parser.getLine(); > System.out.println("result: "+Arrays.toString(tokens)); > {code} > It gets stuck in an infinite loop in CSVParser.nextToken() in the loop around line 347 -- This message was sent by Atlassian JIRA (v6.2#6252)