Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException raised on sftp downloading #751

Open
deskangel opened this issue Jan 22, 2025 · 2 comments
Open

ArrayIndexOutOfBoundsException raised on sftp downloading #751

deskangel opened this issue Jan 22, 2025 · 2 comments

Comments

@deskangel
Copy link

I use the following codes to start sftp downloading:

        var remoteFile: InputStream? = null
            remoteFile = channel?.get(
                args["path"] as String,
                ProgressMonitor(client.id, "DownloadProgress", eventSink)
            )
            val buffer = ByteArray(4096)
            while (true) {
                val count = remoteFile.read(buffer)
                if (count == -1) {
                    break
                }
                outputStream.write(buffer, 0, count)
            }

the following exception raised sometimes:

Exception java.lang.ArrayIndexOutOfBoundsException:
  at java.lang.System.arraycopy
  at com.jcraft.jsch.ChannelSftp$2.read (ChannelSftp.java:1359)
  at java.io.InputStream.skip (InputStream.java:547)
  at com.jcraft.jsch.ChannelSftp$2.read (ChannelSftp.java:1408)
  at com.jcraft.jsch.ChannelSftp$2.read (ChannelSftp.java:1336)

The jsch version is 0.2.17.

Image

@zspitzer
Copy link

Have you tried the latest release?

@deskangel
Copy link
Author

I noticed that some users encountered this error, but I haven't experienced it myself.

After reviewing the release logs, I found no relevant fixes, so I reported this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants