Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3733

splitEachLine

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-beta-1
    • 1.6.5, 1.7.1
    • groovy-jdk
    • None

    Description

      http://groovy.codehaus.org/groovy-jdk/java/lang/String.html#splitEachLine%28java.lang.String%20sep,%20groovy.lang.Closure%20closure%29
      javadoc string says:

      "Iterates through the given String line by line, splitting each line using the given separator. The list of tokens for each line is then passed to the given closure."

      This is flat wrong, it splits the string using a regex match using the argument as a regular expression pattern. Its a major bug because it is bad documentation (as the old saying goes, is worse than no documentation), and it cost me an hour or two.

      The argument should be called regex, not sep, because it is a regular expression, NOT a separator as tokenize uses.

      This is related to GROOVY-3694, but I think this deserves its own bug because it is a separate issue.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              jfrankamp Joshua Frankamp
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: