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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 7
    • core-libs
    • None
    • b74
    • generic
    • generic

      ===

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: