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

DGM.println(Object) and friends do a Writer.close() if the object is a writer. Should be flush() instead.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.7, 1.6-rc-1
    • 1.6-rc-2, 1.5.8
    • None
    • None

    Description

      The DefaultGroovyMethods:

      print(Object)
      println(Object)
      print(Object, Object)
      println(Object, Object)

      all will create a PrintWriter and then do a Writer.close() if self is a Writer. That will close the underlying writer, which is definitely the wrong thing.

      The correct behavior is to do a flush().

      It is easy to see that flushing rather than closing is the right thing by looking at what happens if self is not a Writer. In that case System.out.print(ln) is called and System.out is not closed.

      Attachments

        Activity

          People

            jimwhite James P. White
            jimwhite James P. White
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: