Guard connectPromise not being null 15/101415/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Jun 2022 16:52:45 +0000 (18:52 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Jun 2022 16:52:45 +0000 (18:52 +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>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index f9598210a6ec0a4772d2796958eda212baf64a4f..213b4c13307ab0430d78733c804e8ff4fc15d4be 100644 (file)
@@ -191,8 +191,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 -> {