Committed by
Gerrit Code Review
Fix NPE on shutdown if providers are already gone
Change-Id: I019786f26a589a5b82b72f736fa2d148571ea274
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -74,7 +74,6 @@ import com.google.common.collect.Maps; | ... | @@ -74,7 +74,6 @@ import com.google.common.collect.Maps; |
74 | import com.google.common.collect.Sets; | 74 | import com.google.common.collect.Sets; |
75 | import com.google.common.util.concurrent.Futures; | 75 | import com.google.common.util.concurrent.Futures; |
76 | 76 | ||
77 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
78 | import static org.onosproject.net.DefaultAnnotations.merge; | 77 | import static org.onosproject.net.DefaultAnnotations.merge; |
79 | import static org.onosproject.net.DefaultAnnotations.union; | 78 | import static org.onosproject.net.DefaultAnnotations.union; |
80 | import static org.onosproject.net.Link.State.ACTIVE; | 79 | import static org.onosproject.net.Link.State.ACTIVE; |
... | @@ -353,7 +352,12 @@ public class ECLinkStore | ... | @@ -353,7 +352,12 @@ public class ECLinkStore |
353 | 352 | ||
354 | private Link composeLink(LinkKey linkKey) { | 353 | private Link composeLink(LinkKey linkKey) { |
355 | 354 | ||
356 | - ProviderId baseProviderId = checkNotNull(getBaseProviderId(linkKey)); | 355 | + ProviderId baseProviderId = getBaseProviderId(linkKey); |
356 | + if (baseProviderId == null) { | ||
357 | + // provider was not found, this means it was already removed by the | ||
358 | + // parent component. | ||
359 | + return null; | ||
360 | + } | ||
357 | LinkDescription base = linkDescriptions.get(new Provided<>(linkKey, baseProviderId)); | 361 | LinkDescription base = linkDescriptions.get(new Provided<>(linkKey, baseProviderId)); |
358 | // short circuit if link description no longer exists | 362 | // short circuit if link description no longer exists |
359 | if (base == null) { | 363 | if (base == null) { | ... | ... |
-
Please register or login to post a comment