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

AbstractReaderSource.getLine always returns null when no Janitor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4, 1.7-beta-1
    • Compiler
    • None
    • All
    • Patch

    Description

      I'm trying to read the source code out of a SourceUnit. The API has this method declared:

      org.codehaus.groovy.control.io.ReaderSource.getLine( int lineNumber, Janitor janitor );

      Which is implemented in AbstractReaderSource.

      The API/doc says that Janitor is optional, and the code does let you pass a null.

      However, if you do pass a null janitor then the function always returns null.

      The method is trying to return a field named 'line', but if the janitor is null then cleanup() is called, and line is set to null, so the method always returns null.

      I'll submit a patch myself in the next few days. It is easy to write a test for.

      Attachments

        1. janitor_1.6.xbranch.patch
          4 kB
          Hamlet D'Arcy
        2. abstractReaderSourceGetLine.patch
          4 kB
          Hamlet D'Arcy

        Activity

          People

            hamletdrc Hamlet D'Arcy
            hamletdrc Hamlet D'Arcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified