Avoid down cast
Change-Id: I8e85ca3ac5df8b14f52f4c4e0606bd570853d92a
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.resource.impl; | 16 | package org.onosproject.net.resource.impl; |
17 | 17 | ||
18 | +import com.google.common.collect.Sets; | ||
18 | import org.apache.felix.scr.annotations.Activate; | 19 | import org.apache.felix.scr.annotations.Activate; |
19 | import org.apache.felix.scr.annotations.Component; | 20 | import org.apache.felix.scr.annotations.Component; |
20 | import org.apache.felix.scr.annotations.Deactivate; | 21 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -284,9 +285,8 @@ public class LinkResourceManager implements LinkResourceService { | ... | @@ -284,9 +285,8 @@ public class LinkResourceManager implements LinkResourceService { |
284 | LinkResourceAllocations allocations) { | 285 | LinkResourceAllocations allocations) { |
285 | checkPermission(Permission.LINK_READ); | 286 | checkPermission(Permission.LINK_READ); |
286 | 287 | ||
287 | - Set<ResourceRequest> result = new HashSet<>(); | ||
288 | Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link); | 288 | Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link); |
289 | - result = (Set<ResourceRequest>) getAvailableResources(link); | 289 | + Set<ResourceRequest> result = Sets.newHashSet(getAvailableResources(link)); |
290 | result.addAll(allocatedRes); | 290 | result.addAll(allocatedRes); |
291 | return result; | 291 | return result; |
292 | } | 292 | } | ... | ... |
-
Please register or login to post a comment