During opening the file in this way:
RemoteFile remoteFile = sftpClient.open(path)
I've faced with following error with stacktrace:
java.lang.ArrayIndexOutOfBoundsException: arraycopy: destination index -4 out of bounds for byte[256] at net.schmizz.sshj.common.Buffer.putRawBytes(Buffer.java:271) at net.schmizz.sshj.connection.channel.ChannelOutputStream$DataBuffer.write(ChannelOutputStream.java:64) at net.schmizz.sshj.connection.channel.ChannelOutputStream.write(ChannelOutputStream.java:141) at net.schmizz.sshj.connection.channel.ChannelOutputStream.write(ChannelOutputStream.java:131) at net.schmizz.sshj.sftp.SFTPEngine.transmit(SFTPEngine.java:292) at net.schmizz.sshj.sftp.SFTPEngine.request(SFTPEngine.java:130) at net.schmizz.sshj.sftp.SFTPEngine.doRequest(SFTPEngine.java:136) at net.schmizz.sshj.sftp.SFTPEngine.open(SFTPEngine.java:141) at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:68) at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:73) at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:78) at com.echovox.paidle.common.util.SftpUtil.getFileDataListFromZip(SftpUtil.java:86) at com.echovox.paidle.common.util.SftpUtil.lambda$getFileDataWithRetry$1(SftpUtil.java:139) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
I found 3 implementation of open
method:
public RemoteFile open(String filename)
public RemoteFile open(String filename, Set<OpenMode> mode)
public RemoteFile open(String filename, Set<OpenMode> mode, FileAttributes attrs)
Is it possible to use somehow Set<OpenMode> mode
and/or FileAttributes attrs
to avoid this issue?