commit | f2f8ef043ba7d0e23cd73a57b47e55cd86187792 | [log] [tgz] |
---|---|---|
author | Charles Chan <rascov@gmail.com> | Mon Jun 18 14:42:17 2018 -0700 |
committer | Charles Chan <charles@opennetworking.org> | Thu Jun 21 00:20:25 2018 +0000 |
tree | 77febc39f1c0bfbd550964a99d77ed92c25287b0 | |
parent | 6a7d3677f213f46f3678caf0f8b4ac12dce21af9 [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; }