Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230345

LineNumberReader.ready() can return true despite read() blocking

XMLWordPrintable

    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      This is basically a clone of JDK-4140318. It appears the test code was understood incorrectly and therefore the evalutation was incorrect.

      The return value of Reader.ready() is described as:
      "True if the next read() is guaranteed not to block for input"

      However, if a call to LineNumberReader.read() just compressed \r\n (i.e. skipLF was set to true) then ready() will incorrectly return true even though a subsequent call to read() may block.
      The reason for this is that if read() encounters a \n it will discard it, since it has been compressed and therefore will try to read a second character.


            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: