Committed by
Gerrit Code Review
Fixing NPE in FlowsListCommand when appId is not properly registered
Change-Id: Ic95b67d33d656d645be6a5a63bfef44a11369544
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -27,6 +27,7 @@ import org.apache.karaf.shell.commands.Argument; | ... | @@ -27,6 +27,7 @@ import org.apache.karaf.shell.commands.Argument; |
27 | import org.apache.karaf.shell.commands.Command; | 27 | import org.apache.karaf.shell.commands.Command; |
28 | import org.onosproject.cli.AbstractShellCommand; | 28 | import org.onosproject.cli.AbstractShellCommand; |
29 | import org.onosproject.cli.Comparators; | 29 | import org.onosproject.cli.Comparators; |
30 | +import org.onosproject.core.ApplicationId; | ||
30 | import org.onosproject.core.CoreService; | 31 | import org.onosproject.core.CoreService; |
31 | import org.onosproject.net.Device; | 32 | import org.onosproject.net.Device; |
32 | import org.onosproject.net.DeviceId; | 33 | import org.onosproject.net.DeviceId; |
... | @@ -154,9 +155,10 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -154,9 +155,10 @@ public class FlowsListCommand extends AbstractShellCommand { |
154 | print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size()); | 155 | print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size()); |
155 | if (!empty) { | 156 | if (!empty) { |
156 | for (FlowEntry f : flows) { | 157 | for (FlowEntry f : flows) { |
158 | + ApplicationId appId = coreService.getAppId(f.appId()); | ||
157 | print(FMT, Long.toHexString(f.id().value()), f.state(), | 159 | print(FMT, Long.toHexString(f.id().value()), f.state(), |
158 | f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(), | 160 | f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(), |
159 | - coreService.getAppId(f.appId()).name(), | 161 | + appId != null ? appId.name() : "<none>", |
160 | f.payLoad() == null ? null : f.payLoad().payLoad().toString()); | 162 | f.payLoad() == null ? null : f.payLoad().payLoad().toString()); |
161 | print(SFMT, f.selector().criteria()); | 163 | print(SFMT, f.selector().criteria()); |
162 | print(TFMT, f.treatment()); | 164 | print(TFMT, f.treatment()); | ... | ... |
-
Please register or login to post a comment