Guard connectPromise not being null 45/102745/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Jun 2022 16:52:45 +0000 (18:52 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 17:00:40 +0000 (19:00 +0200)
Make sure that we validated the passed promise to not be null. Also fix
debug output, which would show up null.

Change-Id: Id7490dc57480192f135bf688a973713c3d30ea9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit eaace15120044a3e602fd3093b2412be03fd2133)
(cherry picked from commit 120a71646f1e41680063de2470b5df18e53b9c1c)

netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 412ee2ca1a2430dce9fda103cb7bc8a7373ebecd..0d2f6e1aa5aa42868fb6bcec746a87ee168139a9 100644 (file)
@@ -189,8 +189,8 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
     @Override
     public synchronized void connect(final ChannelHandlerContext ctx, final SocketAddress remoteAddress,
                                      final SocketAddress localAddress, final ChannelPromise promise) throws Exception {
-        LOG.debug("SSH session connecting on channel {}. promise: {}", ctx.channel(), connectPromise);
-        connectPromise = promise;
+        LOG.debug("SSH session connecting on channel {}. promise: {}", ctx.channel(), promise);
+        connectPromise = requireNonNull(promise);
 
         if (negotiationFuture != null) {
             negotiationFutureListener = future -> {