You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2014/08/14 22:08:21 UTC

[jira] [Closed] (CSV-55) Replace while(true)-loop in CSVParser.getRecord() with do-while-loop

     [ https://issues.apache.org/jira/browse/CSV-55?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benedikt Ritter closed CSV-55.
------------------------------


> Replace while(true)-loop in CSVParser.getRecord() with do-while-loop
> --------------------------------------------------------------------
>
>                 Key: CSV-55
>                 URL: https://issues.apache.org/jira/browse/CSV-55
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>    Affects Versions: 1.0
>            Reporter: Benedikt Ritter
>            Priority: Trivial
>             Fix For: 1.0
>
>         Attachments: CSV-55.txt
>
>
> The current implementation of {{getRecords()}} uses a while(true) loop, that gets canceled by an if statement:
> {code:java}
> while (true) {
>     reusableToken.reset();
>     lexer.nextToken(reusableToken);
>     // omitted
>     if(reusableToken.type != TOKEN) {
>         break;
>     }
> }
> {code}
> This should be replaced by a do-while-loop:
> {code:java}
> do {
>     reusableToken.reset();
>     lexer.nextToken(reusableToken);
>     // omitted
> } while (reusableToken.type == TOKEN);
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)