Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-55

Replace while(true)-loop in CSVParser.getRecord() with do-while-loop

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0
    • Component/s: Parser
    • Labels:
      None

      Description

      The current implementation of getRecords() uses a while(true) loop, that gets canceled by an if statement:

      while (true) {
          reusableToken.reset();
          lexer.nextToken(reusableToken);
          // omitted
          if(reusableToken.type != TOKEN) {
              break;
          }
      }
      

      This should be replaced by a do-while-loop:

      do {
          reusableToken.reset();
          lexer.nextToken(reusableToken);
          // omitted
      } while (reusableToken.type == TOKEN);
      

        Attachments

        1. CSV-55.txt
          1 kB
          Benedikt Ritter

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              britter Benedikt Ritter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: