[
https://issues.apache.org/jira/browse/SSHD-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681242#comment-17681242
]
Andreas Bergander commented on SSHD-1319:
-----------------------------------------
I've submitted a PR which adds the missing call to setOffset(position):
https://github.com/apache/mina-sshd/pull/316
Regarding your comment about the condition for breaking out of the loop, that's
is exactly why I needed to create an outer loop with an offset in my call to
transferFrom(...). But maybe it would be a good idea to continue to read if the
returned value is 0? Or does that break some contract of
FileChannel.transferFrom(...)? Maybe it should be up to the caller to make sure
everything has been transferred. Otherwise something like this could help:
{code:java}
if (read > 0) {
output.write(buffer, 0, read);
totalRead += read;
} else if (read < 0) {
break;
}{code}
> SftpRemotePathChannel.transferFrom(...) ignores position argument
> -----------------------------------------------------------------
>
> Key: SSHD-1319
> URL: https://issues.apache.org/jira/browse/SSHD-1319
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.9.2
> Reporter: Andreas Bergander
> Priority: Major
>
> The _position_ argument in the _SftpRemotePathChannel.transferFrom(...)_
> method seems only to be used when validating it and in debug logging.
> It should also affect where the data is written to the remote file. Perhaps
> it could be fixed with adding a call to
> {_}SftpOutputStreamAsync.setOffset(...){_}?
> {code:java}
> output.setOffset(position);{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]