You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2017/08/23 17:14:00 UTC

[jira] [Assigned] (SSHD-765) SFTP client fails to retrieve a binary file using an InputStream

     [ https://issues.apache.org/jira/browse/SSHD-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Goldstein Lyor reassigned SSHD-765:
-----------------------------------

    Assignee: Goldstein Lyor

> SFTP client fails to retrieve a binary file using an InputStream
> ----------------------------------------------------------------
>
>                 Key: SSHD-765
>                 URL: https://issues.apache.org/jira/browse/SSHD-765
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.6.0
>            Reporter: Michael Binder
>            Assignee: Goldstein Lyor
>
> The SFTP client fails to retrieve a binary file from an SFTP server using the InputStream returned by the {{SftpClient.read (String)}} method.
> In my case the binary file was actually a gzipped XML file. So I wrapped the returned InputStream in a {{java.util.zip.GZIPInputStream}} object. When reading from the stream I received an IOException with following message:
> "org.apache.sshd.client.subsystem.sftp.SftpInputStreamWithChannel.read() returned value out of range -1..255: -117".
> I think that this method violates the contract given in {{java.io.InputStream}}: "The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned."
> After I patched line 130 in SftpInputStreamWithChannel.java to
> {code:java}
>             return bb[0] & 0xFF;
> {code}
> retrieving the file seemed to have worked fine.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)