Fixes NPE in CLI when user enters non-existent DPID in "flows any <dpid>" command.
Sorts flows according to table-id first, and then flow-id, so all flows
from the same table print together.

Change-Id: I4a811a00a1dc0e1e2f2855c06f5f7f9851152c0d
diff --git a/cli/src/main/java/org/onosproject/cli/Comparators.java b/cli/src/main/java/org/onosproject/cli/Comparators.java
index 1df2f04..03d25ce 100644
--- a/cli/src/main/java/org/onosproject/cli/Comparators.java
+++ b/cli/src/main/java/org/onosproject/cli/Comparators.java
@@ -71,7 +71,10 @@
     public static final Comparator<FlowRule> FLOW_RULE_COMPARATOR = new Comparator<FlowRule>() {
         @Override
         public int compare(FlowRule f1, FlowRule f2) {
-            return Long.valueOf(f1.id().value()).compareTo(f2.id().value());
+            int tableCompare = Integer.valueOf(f1.tableId()).compareTo(f2.tableId());
+            return (tableCompare == 0)
+                    ? Long.valueOf(f1.id().value()).compareTo(f2.id().value())
+                    : tableCompare;
         }
     };