ONOS-4395 Fix NPE in OpenFlowDeviceProvider
Following gerrit #8858 Change-Id: I55cc4d9ee028e11e099657752a12d2c026893a59
Showing
1 changed file
with
5 additions
and
6 deletions
| ... | @@ -311,10 +311,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -311,10 +311,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
| 311 | List<OFPortStatsEntry> entries) { | 311 | List<OFPortStatsEntry> entries) { |
| 312 | HashSet<PortStatistics> stats = Sets.newHashSet(); | 312 | HashSet<PortStatistics> stats = Sets.newHashSet(); |
| 313 | 313 | ||
| 314 | - if (entries == null) { | ||
| 315 | - return Collections.unmodifiableSet(stats); | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | for (OFPortStatsEntry entry : entries) { | 314 | for (OFPortStatsEntry entry : entries) { |
| 319 | try { | 315 | try { |
| 320 | if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) { | 316 | if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) { |
| ... | @@ -793,8 +789,11 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -793,8 +789,11 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
| 793 | portStatsReplyList.addAll(portStatsReply.getEntries()); | 789 | portStatsReplyList.addAll(portStatsReply.getEntries()); |
| 794 | portStatsReplies.put(dpid, portStatsReplyList); | 790 | portStatsReplies.put(dpid, portStatsReplyList); |
| 795 | if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) { | 791 | if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) { |
| 796 | - pushPortMetrics(dpid, portStatsReplies.get(dpid)); | 792 | + List<OFPortStatsEntry> statsEntries = portStatsReplies.get(dpid); |
| 797 | - portStatsReplies.get(dpid).clear(); | 793 | + if (statsEntries != null) { |
| 794 | + pushPortMetrics(dpid, statsEntries); | ||
| 795 | + statsEntries.clear(); | ||
| 796 | + } | ||
| 798 | } | 797 | } |
| 799 | } | 798 | } |
| 800 | break; | 799 | break; | ... | ... |
-
Please register or login to post a comment