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

java.lang.ArrayIndexOutOfBoundsException with jsch version 0.2.18 #591

Closed
swathimr opened this issue Jul 9, 2024 · 5 comments
Closed

java.lang.ArrayIndexOutOfBoundsException with jsch version 0.2.18 #591

swathimr opened this issue Jul 9, 2024 · 5 comments

Comments

@swathimr
Copy link

swathimr commented Jul 9, 2024

I am using JSCH to connect to SFTP with high traffic and recently updated the library from com.jcraft. We saw this error recently and in local environment I am not able to reproduce the issue.

Screenshot 2024-07-09 at 4 03 24 PM

Screenshot 2024-07-09 at 4 06 56 PM
Can you please let me know whats causing this ?

@norrisjeremy
Copy link
Contributor

You have a bug in your code.
The lines where you are calling JSch.setConfig("server_host_key", ...) and JSch.setConfig("PubkeyAcceptedAlgorithms", ...), you are constantly appending ,ssh-rsa,ssh-dss over and over to them every time you call your getConnection() method.

@swathimr
Copy link
Author

swathimr commented Jul 9, 2024

@norrisjeremy
Copy link
Contributor

JSch.setConfig() are static methods that act on global static state.
If you need to change this on a per-session basis, then you should use session.setConfig(), so that it doesn't constantly change global static state.

@swathimr
Copy link
Author

swathimr commented Jul 9, 2024

okay I will try that. Does this issue occur only with the heavy load or multiple connects ?

@norrisjeremy
Copy link
Contributor

Hi @swathimr,

This has nothing to do with heavy load or multiple connects: your code is simply flawed.

Thanks,
Jeremy

@mwiede mwiede closed this as completed Aug 6, 2024
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

3 participants