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

(file) Path.newInputStream does not usefully implement available()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b74
    • CPU:
      generic
    • OS:
      generic

      Description

      ===

      Bad news:
      I think I've found a bug in Path.newInputStream() for the default file system. The stream that is returned immediately returns 0 for available(). The javadoc for InputStream woffles a bit but somewhat indicates that 0 means end of file. It seems unreasonable for Path.newInputStream() to return a stream like this. The consequence is that javac immediately thinks the file is empty and stops reading it. If I use FilterInputStream to override the value to always return 1 then javac gets a lot further with this file manager.

      -- Jon

      ===

      This is a specific case of:
        4648049: (ch) Stream adaptors do not usefully implement available()

      Where the channel is to a file (or more generally, a SeekableByteChannel) then it can be special-cased so that the input stream behaves like FileInputStream.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alanb Alan Bateman
                Reporter:
                alanb Alan Bateman
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: