Committed by
Gerrit Code Review
Resolve NPE during control message aggregation
Change-Id: I1945a3ec23fbe6c54af53845b89f489fa9857605
Showing
1 changed file
with
8 additions
and
2 deletions
... | @@ -209,7 +209,10 @@ public class OpenFlowControlMessageProvider extends AbstractProvider | ... | @@ -209,7 +209,10 @@ public class OpenFlowControlMessageProvider extends AbstractProvider |
209 | if (msg.getType() == OFType.PACKET_IN || | 209 | if (msg.getType() == OFType.PACKET_IN || |
210 | msg.getType() == OFType.FLOW_MOD || | 210 | msg.getType() == OFType.FLOW_MOD || |
211 | msg.getType() == OFType.STATS_REPLY) { | 211 | msg.getType() == OFType.STATS_REPLY) { |
212 | - aggregators.get(dpid).increment(msg); | 212 | + aggregators.computeIfPresent(dpid, (k, v) -> { |
213 | + v.increment(msg); | ||
214 | + return v; | ||
215 | + }); | ||
213 | } | 216 | } |
214 | } | 217 | } |
215 | } | 218 | } |
... | @@ -221,7 +224,10 @@ public class OpenFlowControlMessageProvider extends AbstractProvider | ... | @@ -221,7 +224,10 @@ public class OpenFlowControlMessageProvider extends AbstractProvider |
221 | 224 | ||
222 | @Override | 225 | @Override |
223 | public void handleMessage(Dpid dpid, OFMessage msg) { | 226 | public void handleMessage(Dpid dpid, OFMessage msg) { |
224 | - aggregators.get(dpid).increment(msg); | 227 | + aggregators.computeIfPresent(dpid, (k, v) -> { |
228 | + v.increment(msg); | ||
229 | + return v; | ||
230 | + }); | ||
225 | } | 231 | } |
226 | } | 232 | } |
227 | } | 233 | } | ... | ... |
-
Please register or login to post a comment