Committed by
Gerrit Code Review
Fixed an NPE in device manager/provider.
Change-Id: I0240bc6f591881efefc1043eb620068d6ab2d9a4
Showing
2 changed files
with
2 additions
and
2 deletions
... | @@ -18,6 +18,7 @@ package org.onosproject.net.device.impl; | ... | @@ -18,6 +18,7 @@ package org.onosproject.net.device.impl; |
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 19 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
20 | import static org.onlab.util.Tools.groupedThreads; | 20 | import static org.onlab.util.Tools.groupedThreads; |
21 | +import static org.onlab.util.Tools.nullIsNotFound; | ||
21 | import static org.onosproject.net.MastershipRole.MASTER; | 22 | import static org.onosproject.net.MastershipRole.MASTER; |
22 | import static org.onosproject.net.MastershipRole.NONE; | 23 | import static org.onosproject.net.MastershipRole.NONE; |
23 | import static org.onosproject.net.MastershipRole.STANDBY; | 24 | import static org.onosproject.net.MastershipRole.STANDBY; |
... | @@ -435,7 +436,7 @@ public class DeviceManager | ... | @@ -435,7 +436,7 @@ public class DeviceManager |
435 | portDescription); | 436 | portDescription); |
436 | return; | 437 | return; |
437 | } | 438 | } |
438 | - final Device device = getDevice(deviceId); | 439 | + Device device = nullIsNotFound(getDevice(deviceId), "Device not found"); |
439 | if ((Device.Type.ROADM.equals(device.type()))) { | 440 | if ((Device.Type.ROADM.equals(device.type()))) { |
440 | Port port = getPort(deviceId, portDescription.portNumber()); | 441 | Port port = getPort(deviceId, portDescription.portNumber()); |
441 | portDescription = OpticalPortOperator.descriptionOf(port, portDescription.isEnabled()); | 442 | portDescription = OpticalPortOperator.descriptionOf(port, portDescription.isEnabled()); | ... | ... |
... | @@ -377,7 +377,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -377,7 +377,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
377 | public void receivedRoleReply(Dpid dpid, RoleState requested, RoleState response) { | 377 | public void receivedRoleReply(Dpid dpid, RoleState requested, RoleState response) { |
378 | MastershipRole request = roleOf(requested); | 378 | MastershipRole request = roleOf(requested); |
379 | MastershipRole reply = roleOf(response); | 379 | MastershipRole reply = roleOf(response); |
380 | - | ||
381 | providerService.receivedRoleReply(deviceId(uri(dpid)), request, reply); | 380 | providerService.receivedRoleReply(deviceId(uri(dpid)), request, reply); |
382 | } | 381 | } |
383 | 382 | ... | ... |
-
Please register or login to post a comment