Simplify isStateChangePermitted() 54/102754/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Oct 2022 00:01:35 +0000 (02:01 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Oct 2022 00:03:05 +0000 (02:03 +0200)
We have a duplicate check of old state value, merge two 'if' statements
together.

Change-Id: I36611230ef27de80f91a61b604e7bd71646c4718
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index afd77d17b17ea1c59b5d970cac86a24d5d1f6fd2..13b4d32edcf7775616b06aa2eec739dd043f1577 100644 (file)
@@ -294,10 +294,7 @@ public abstract class AbstractNetconfSessionNegotiator<S extends AbstractNetconf
         if (state == State.IDLE && newState == State.OPEN_WAIT) {
             return true;
         }
-        if (state == State.OPEN_WAIT && newState == State.ESTABLISHED) {
-            return true;
-        }
-        if (state == State.OPEN_WAIT && newState == State.FAILED) {
+        if (state == State.OPEN_WAIT && (newState == State.ESTABLISHED || newState == State.FAILED)) {
             return true;
         }
         LOG.debug("Transition from {} to {} is not allowed", state, newState);