Committed by
Gerrit Code Review
ONOS-2796: Fix removeLink NPE when links are removed concurrently from multiple nodes
Change-Id: I99d9bbe143ea4c8906f5ea4d5595a7f7bcddad49
Showing
1 changed file
with
6 additions
and
1 deletions
... | @@ -336,8 +336,13 @@ public class ECLinkStore | ... | @@ -336,8 +336,13 @@ public class ECLinkStore |
336 | @Override | 336 | @Override |
337 | public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { | 337 | public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { |
338 | final LinkKey linkKey = LinkKey.linkKey(src, dst); | 338 | final LinkKey linkKey = LinkKey.linkKey(src, dst); |
339 | + ProviderId primaryProviderId = getBaseProviderId(linkKey); | ||
340 | + // Stop if there is no base provider. | ||
341 | + if (primaryProviderId == null) { | ||
342 | + return null; | ||
343 | + } | ||
339 | LinkDescription removedLinkDescription = | 344 | LinkDescription removedLinkDescription = |
340 | - linkDescriptions.remove(new Provided<>(linkKey, checkNotNull(getBaseProviderId(linkKey)))); | 345 | + linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); |
341 | if (removedLinkDescription != null) { | 346 | if (removedLinkDescription != null) { |
342 | return purgeLinkCache(linkKey); | 347 | return purgeLinkCache(linkKey); |
343 | } | 348 | } | ... | ... |
-
Please register or login to post a comment