Use Future.cause() for error checking 64/102764/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 18:59:34 +0000 (20:59 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Oct 2022 22:52:05 +0000 (00:52 +0200)
Include error trace when terminating session.

Change-Id: I02faabd68cf8f9ad89dc0273e9a85641d12c8db6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 78e5a0d290329a908d262a5114e9d191f137347f)

netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 053540c758e9122ec7b302b653597145eac45d4c..caf1bb4e86443039af2a6dca454c3bd239ebc90e 100644 (file)
@@ -180,10 +180,11 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
                 changeState(State.FAILED);
 
                 channel.close().addListener(future -> {
-                    if (future.isSuccess()) {
-                        LOG.debug("Channel {} closed: success", channel);
+                    final var cause = future.cause();
+                    if (cause != null) {
+                        LOG.warn("Channel {} closed: fail", channel, cause);
                     } else {
-                        LOG.warn("Channel {} closed: fail", channel);
+                        LOG.debug("Channel {} closed: success", channel);
                     }
                 });
             }