Committed by
Gerrit Code Review
[ONOS-4772] Avoid throwing NPE on optical resource queries.
Change-Id: I71ac76b7b456b19a8dabf78a0ef52366867cd230
Showing
2 changed files
with
5 additions
and
1 deletions
| ... | @@ -66,6 +66,10 @@ public class DefaultTributarySlotQuery extends AbstractHandlerBehaviour implemen | ... | @@ -66,6 +66,10 @@ public class DefaultTributarySlotQuery extends AbstractHandlerBehaviour implemen |
| 66 | DeviceService deviceService = opticalView(this.handler().get(DeviceService.class)); | 66 | DeviceService deviceService = opticalView(this.handler().get(DeviceService.class)); |
| 67 | Port p = deviceService.getPort(this.data().deviceId(), port); | 67 | Port p = deviceService.getPort(this.data().deviceId(), port); |
| 68 | 68 | ||
| 69 | + if (p == null) { | ||
| 70 | + return Collections.emptySet(); | ||
| 71 | + } | ||
| 72 | + | ||
| 69 | switch (p.type()) { | 73 | switch (p.type()) { |
| 70 | case OCH: | 74 | case OCH: |
| 71 | return queryOchTributarySlots(p); | 75 | return queryOchTributarySlots(p); | ... | ... |
drivers/optical/src/main/java/org/onosproject/driver/optical/query/OFOpticalSwitch13LambdaQuery.java
| ... | @@ -52,7 +52,7 @@ public class OFOpticalSwitch13LambdaQuery extends AbstractHandlerBehaviour imple | ... | @@ -52,7 +52,7 @@ public class OFOpticalSwitch13LambdaQuery extends AbstractHandlerBehaviour imple |
| 52 | Port p = deviceService.getPort(this.data().deviceId(), port); | 52 | Port p = deviceService.getPort(this.data().deviceId(), port); |
| 53 | 53 | ||
| 54 | // Only OMS ports expose lambda resources | 54 | // Only OMS ports expose lambda resources |
| 55 | - if (!p.type().equals(Port.Type.OMS)) { | 55 | + if (p == null || !p.type().equals(Port.Type.OMS)) { |
| 56 | return Collections.emptySet(); | 56 | return Collections.emptySet(); |
| 57 | } | 57 | } |
| 58 | 58 | ... | ... |
-
Please register or login to post a comment