Remove duplicate message type check 74/77974/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Nov 2018 11:59:44 +0000 (12:59 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Nov 2018 11:59:44 +0000 (12:59 +0100)
Rather than performing two instanceof checks, use an if/else
construct to dispatch message.

Change-Id: I4ce5aba7e1c826fe343b279c9767193d0ba83154
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java

index 5af8678c77dd7acd9745a84180d138760b661f87..19ae968c680dbdde4bc42cea9492e18698d37266 100644 (file)
@@ -237,14 +237,12 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
 
     @Override
     public void onMessage(final BGPSession session, final Notification msg) throws BGPDocumentedException {
-        if (!(msg instanceof Update) && !(msg instanceof RouteRefresh)) {
-            LOG.info("Ignoring unhandled message class {}", msg.getClass());
-            return;
-        }
         if (msg instanceof Update) {
             onUpdateMessage((Update) msg);
-        } else {
+        } else if (msg instanceof RouteRefresh) {
             onRouteRefreshMessage((RouteRefresh) msg);
+        } else {
+            LOG.info("Ignoring unhandled message class {}", msg.getClass());
         }
     }