Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12607

When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.21.1
    • Fix Version/s: 2.21.2, 2.22.1, 2.23.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I use .split().tokenize("\n", 10000, true).streaming() to stream csv file with header row and skip first line.
      When file contains ONLY header row - java.util.NoSuchElementException is thrown in https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158, because when it skips first line - it does not check if it has next line and just calls next().

        Attachments

          Activity

            People

            • Assignee:
              dmvolod Dmitry Volodin
              Reporter:
              ssavenko Sergey Savenko
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: