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

Check error stream is not null before notifying error #961

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

ramkumarr
Copy link
Contributor

Fixes #955

We are getting this exception frequently, when the network to the server is poor (ie., there are a lot of dropped packets at the server, for example):

java.lang.NullPointerException: null
	at net.schmizz.sshj.connection.channel.direct.SessionChannel.notifyError(SessionChannel.java:228) ~[sshj-0.31.0.jar:0.31.0]
	at net.schmizz.sshj.common.ErrorNotifiable$Util.alertAll(ErrorNotifiable.java:35) ~[sshj-0.31.0.jar:0.31.0]
	at net.schmizz.sshj.connection.ConnectionImpl.notifyError(ConnectionImpl.java:261) ~[sshj-0.31.0.jar:0.31.0]
	at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:620) ~[sshj-0.31.0.jar:0.31.0]
	at net.schmizz.sshj.transport.Reader.run(Reader.java:66) ~[sshj-0.31.0.jar:0.31.0]

I can't really see how the err variable in SessionChannel can be null, but apparently sometimes it is.
This kind of check is already done in AbstractChannel.notifyError (although only for the out stream), so I'm doing it in SessionChannel as well.

@ramkumarr ramkumarr requested a review from hierynomus as a code owner August 28, 2024 10:51
@hierynomus hierynomus merged commit 31ed354 into hierynomus:master Sep 13, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

NullPointerException when trying to handle exception in notifyError
2 participants