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

Goldstein Lyor resolved SSHD-765.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 1.7.0

Fixed - see [this 
commit|https://github.com/apache/mina-sshd/commit/b3c8181e88de8e0d6c279e45cd5a9ee544d35d1d]
  credited to you

> 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
>             Fix For: 1.7.0
>
>
> 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)

Reply via email to