lzzcg opened a new issue, #407:
URL: https://github.com/apache/mina-sshd/issues/407

   ### Version
   
   2.10.0
   
   ### Bug description
   
   at **org.apache.sshd.sftp.client.fs.SftpFileSystemProvider#newOutputStream** 
method, SftpOutputStreamAsync is decorated by FilterOutputStream. 
   
   the java.io.FilterOutputStream#write(byte[], int, int) method will invoke 
the org.apache.sshd.sftp.client.impl.SftpOutputStreamAsync#write(int) method 
each byte in a loop, this cause the buffer in SftpOutputStreamAsync is 
Invalidation。
   
   
   
   ### Actual behavior
   
   at **org.apache.sshd.sftp.client.fs.SftpFileSystemProvider#newOutputStream** 
method, SftpOutputStreamAsync is decorated by FilterOutputStream. 
   
   the java.io.FilterOutputStream#write(byte[], int, int) method will invoke 
the org.apache.sshd.sftp.client.impl.SftpOutputStreamAsync#write(int) method 
each byte in a loop, this cause the buffer in SftpOutputStreamAsync is 
Invalidation。
   
   
   
   ### Expected behavior
   
   override the java.io.FilterOutputStream#write(byte[], int, int) method in 
org.apache.sshd.sftp.client.fs.SftpFileSystemProvider#newOutputStream  like 
below:
   
   return new FilterOutputStream(client.write(p.toString(), modes)) {
   
                               @Override
                               public void close() throws IOException {
                                   try {
                                       super.close();
                                   } finally {
                                       client.close();
                                   }
                               }
   
                               @Override
                               public void write(byte b[], int off, int len) 
throws IOException {
                                   if ((off | len | (b.length - (len + off)) | 
(off + len)) < 0) {
                                       throw new IndexOutOfBoundsException();
                                   }
                                   out.write(b, off, len);
                               }
                           };
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to