You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2018/11/20 15:05:00 UTC
[jira] [Resolved] (VFS-674) Cannot close an FTP input stream
without an exception
[ https://issues.apache.org/jira/browse/VFS-674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory resolved VFS-674.
------------------------------
Resolution: Fixed
Fix Version/s: 2.3
Applied a modified patch from Boris Petrov to avoid breaking binary compatibility.
Please verify and close.
> Cannot close an FTP input stream without an exception
> -----------------------------------------------------
>
> Key: VFS-674
> URL: https://issues.apache.org/jira/browse/VFS-674
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.2
> Reporter: Boris Petrov
> Priority: Critical
> Labels: pull-request-available
> Fix For: 2.3
>
>
> 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:
> {code:java}
> try (FileContent content = ftpFileObject.getContent()) {
> // ......
> }
> {code}
> Is there an easy way we can patch this in VFS as this is a showstopper for us?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)