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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
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


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 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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary Gregory-4
I do not think we need to tickets for this kind of change.

Gary

On Mar 12, 2012, at 9:59, "Benedikt Ritter (Created) (JIRA)" <[hidden email]> wrote:

> 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
>
>
> 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 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
>
>
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Emmanuel Bourg resolved CSV-55.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0

Thank you, that's fixed on the trunk.
               

> 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 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

       
Reply | Threaded
Open this post in threaded view
|

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

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Benedikt Ritter updated CSV-55:
-------------------------------

    Attachment: CSV-55.txt

patch attached ;)
               

> 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 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