commit | 74d1a9b25eef4dc02a578767f3a74759314e3b8a | [log] [tgz] |
---|---|---|
author | Charles Chan <rascov@gmail.com> | Mon Jun 18 14:42:17 2018 -0700 |
committer | Charles Chan <rascov@gmail.com> | Wed Jun 20 16:31:32 2018 -0700 |
tree | e94264822f0303fed362dff0d7035229cbbeee00 | |
parent | 396a0c67c1335343e570ecdbc59920e2f3b72a8f [diff] |
Fix ConcurrentModificationException Change-Id: Ie4c3a56312156ded1cbc2fd8a0e4da822ff57205
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java index 626109a..704db9a 100644 --- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java +++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -463,9 +463,12 @@ */ public Set<IpPrefix> getSubnets(DeviceId deviceId) { SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId); - if (srinfo != null) { + if (srinfo != null && srinfo.subnets != null) { + // Note: ImmutableSet.Builder.addAll calls the iterator of parameter internally, + // which is not protected by SynchronizedCollection mutex. ImmutableSet.Builder<IpPrefix> builder = ImmutableSet.builder(); - return builder.addAll(srinfo.subnets.values()).build(); + srinfo.subnets.forEach((k, v) -> builder.add(v)); + return builder.build(); } return null; }