Move logging out of try/catch block 43/102743/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Jun 2022 16:55:31 +0000 (18:55 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 17:00:25 +0000 (19:00 +0200)
We are catching just IOException, there is no point to include logging
in the block.

Change-Id: I4650513ea444b506068182586153a627bfaff2b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 22755ee880d798830f42cc0d60e84c8602fe3794)
(cherry picked from commit 09983568c97cefacb96677336bd8c37adc2dafe0)

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

index f33fdd8328257ba5e099c3e4e28022dad2e97105..1c89e7761c64de6469c36eca6eb4f9700163baed 100644 (file)
@@ -140,10 +140,10 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
 
     private synchronized void handleSshAuthenticated(final NettyAwareClientSession newSession,
             final ChannelHandlerContext ctx) {
-        try {
-            LOG.debug("SSH session authenticated on channel: {}, server version: {}", ctx.channel(),
-                    newSession.getServerVersion());
+        LOG.debug("SSH session authenticated on channel: {}, server version: {}", ctx.channel(),
+            newSession.getServerVersion());
 
+        try {
             channel = newSession.createSubsystemChannel(SUBSYSTEM, ctx);
             channel.setStreaming(ClientChannel.Streaming.Async);
             channel.open().addListener(future -> {
@@ -153,8 +153,6 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
                     handleSshSetupFailure(ctx, future.getException());
                 }
             });
-
-
         } catch (final IOException e) {
             handleSshSetupFailure(ctx, e);
         }