Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-674

Cannot close an FTP input stream without an exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.2
    • 2.3

    Description

      The FTP server is FileZilla.

      1. Get a stream instance from an FtpFileObject via the `getInputStream` method.
      2. Read some bytes from the stream.
      3. Close the stream via `stream.close()`.
      4. If the stream has not been completely read, the FTP server sends a `426 Connection closed; transfer aborted` response code.
      5. `FtpFileObject::onClose` is called.
      6. Eventually `FTPReply::isPositiveCompletion` is called.
      7. Since the response code is outside the [200; 300) range it is considered an error.
      8. A `FileSystemException` is thrown.

      The overall result is that when closing a stream that is not completely read an exception is thrown. Which is obviously wrong.

      A similar things happens with this piece of code:

      try (FileContent content = ftpFileObject.getContent()) {
          // ......
      }
      

      Is there an easy way we can patch this in VFS as this is a showstopper for us?

      Attachments

        Activity

          People

            Unassigned Unassigned
            boris-petrov Boris Petrov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: