[ https://issues.apache.org/jira/browse/VFS-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16676880#comment-16676880 ]
Boris Petrov commented on VFS-674: ---------------------------------- I've added a pull-request that fixes this: https://github.com/apache/commons-vfs/pull/41 > 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 > > 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)