Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 35782 invoked from network); 10 Jan 2011 23:06:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jan 2011 23:06:09 -0000 Received: (qmail 78576 invoked by uid 500); 10 Jan 2011 23:06:09 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 78373 invoked by uid 500); 10 Jan 2011 23:06:09 -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 78365 invoked by uid 99); 10 Jan 2011 23:06:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jan 2011 23:06:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jan 2011 23:06:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0AN5j2J022275 for ; Mon, 10 Jan 2011 23:05:46 GMT Message-ID: <32740352.268671294700745838.JavaMail.jira@thor> Date: Mon, 10 Jan 2011 18:05:45 -0500 (EST) From: "Toli Kuznets (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (SANDBOX-331) 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 X-Virus-Checked: Checked by ClamAV on apache.org CSVParser hangs (goes into infinite loop) on getLine() if it's a "comment" line that doesn't contain a delimiter ---------------------------------------------------------------------------------------------------------------- Key: SANDBOX-331 URL: https://issues.apache.org/jira/browse/SANDBOX-331 Project: Commons Sandbox Issue Type: Bug Components: CSV Reporter: Toli Kuznets When 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 is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.