You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Toli Kuznets (JIRA)" <ji...@apache.org> on 2011/01/11 00:03:49 UTC
[jira] Created: (SANDBOX-330) CSVParser hangs (goes into infinite
loop) on getLine() if it's a "comment" line that doesn't contain a
delimiter
CSVParser hangs (goes into infinite loop) on getLine() if it's a "comment" line that doesn't contain a delimiter
----------------------------------------------------------------------------------------------------------------
Key: SANDBOX-330
URL: https://issues.apache.org/jira/browse/SANDBOX-330
Project: Commons Sandbox
Issue Type: Bug
Components: CSV
Affects Versions: Nightly Builds
Reporter: Toli Kuznets
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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Resolved] (SANDBOX-330) CSVParser hangs (goes into infinite
loop) on getLine() if it's a "comment" line that doesn't contain a
delimiter
Posted by "Emmanuel Bourg (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SANDBOX-330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bourg resolved SANDBOX-330.
------------------------------------
Resolution: Cannot Reproduce
Fix Version/s: CSV 1.0
Thank you for the detailed report Toli. I ran your example against the current trunk and it worked fine. Could you give it another try and reopen this issue if it's not working for you?
> CSVParser hangs (goes into infinite loop) on getLine() if it's a "comment" line that doesn't contain a delimiter
> ----------------------------------------------------------------------------------------------------------------
>
> Key: SANDBOX-330
> URL: https://issues.apache.org/jira/browse/SANDBOX-330
> Project: Commons Sandbox
> Issue Type: Bug
> Components: CSV
> Affects Versions: Nightly Builds
> Reporter: Toli Kuznets
> Fix For: CSV 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 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