Process open mesage more defensively 61/91761/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 29 Jul 2020 15:52:04 +0000 (17:52 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 29 Jul 2020 17:24:45 +0000 (17:24 +0000)
We are already handling documented exceptions, but we may end up
ignoring a runtime exceptions. Add a defensive catch.

JIRA: BGPCEP-915
Change-Id: I921395d9a36fd7fcadfeef882d181abc10db2b13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractBGPSessionNegotiator.java

index 9544149cbab6fde2c16791d58638e4fe9f4c4ee9..da612b5ecae6e9b2ae42cfeaf0c23e2bdfe5ec58 100644 (file)
@@ -196,6 +196,7 @@ abstract class AbstractBGPSessionNegotiator extends ChannelInboundHandlerAdapter
         return builder.build();
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private synchronized void handleOpen(final Open openObj) {
         final IpAddressNoZone remoteIp = getRemoteIp();
         final BGPSessionPreferences preferences = this.registry.getPeerPreferences(remoteIp);
@@ -207,7 +208,7 @@ abstract class AbstractBGPSessionNegotiator extends ChannelInboundHandlerAdapter
             this.session = new BGPSessionImpl(peer, this.channel, openObj, preferences, this.registry);
             this.session.setChannelExtMsgCoder(openObj);
             LOG.debug("Channel {} moved to OPEN_CONFIRM state with remote proposal {}", this.channel, openObj);
-        } catch (final BGPDocumentedException e) {
+        } catch (final BGPDocumentedException | RuntimeException e) {
             LOG.warn("Channel {} negotiation failed", this.channel, e);
             negotiationFailed(e);
         }