Simplify isStateChangePermitted() 66/102766/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 22:52:57 +0000 (00:52 +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>
(cherry picked from commit a4a4f3cde22d044c7bd97b80b307f58c90d12c62)

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

index caf1bb4e86443039af2a6dca454c3bd239ebc90e..4705d32f6a8373805371ccf1fd0b43d8dabbfa8e 100644 (file)
@@ -297,10 +297,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
         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);