Fix logging and formatting 87/69287/1
authoresobmar <mariusz.sobucki@ericsson.com>
Thu, 27 Sep 2018 11:32:50 +0000 (12:32 +0100)
committeresobmar <mariusz.sobucki@ericsson.com>
Thu, 27 Sep 2018 11:34:32 +0000 (12:34 +0100)
Change-Id: I7f0a8f5c484c6ade153e307acb16569af4d9d2bc
Signed-off-by: Mariusz Sobucki <mariusz.sobucki@ericsson.com>
Issue-ID: DMAAP-775

datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java

index 242c105..832b8ed 100644 (file)
@@ -44,13 +44,14 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB;
  * @version $Id: EgressRoute.java,v 1.3 2013/12/16 20:30:23 eby Exp $\r
  */\r
 public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {\r
  * @version $Id: EgressRoute.java,v 1.3 2013/12/16 20:30:23 eby Exp $\r
  */\r
 public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {\r
+\r
     private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
     private final int subid;\r
     private final int nodeid;\r
 \r
     /**\r
     private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
     private final int subid;\r
     private final int nodeid;\r
 \r
     /**\r
-     * Get a set of all Egress Routes in the DB.  The set is sorted according to the natural sorting order\r
-     * of the routes (based on the subscription ID in each route).\r
+     * Get a set of all Egress Routes in the DB.  The set is sorted according to the natural sorting order of the routes\r
+     * (based on the subscription ID in each route).\r
      *\r
      * @return the sorted set\r
      */\r
      *\r
      * @return the sorted set\r
      */\r
@@ -60,15 +61,15 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-           try( Statement stmt = conn.createStatement()) {\r
-               try(ResultSet rs = stmt.executeQuery("select SUBID, NODEID from EGRESS_ROUTES")) {\r
-                   while (rs.next()) {\r
-                       int subid = rs.getInt("SUBID");\r
-                       int nodeid = rs.getInt("NODEID");\r
-                       set.add(new EgressRoute(subid, nodeid));\r
-                   }\r
-               }\r
-           }\r
+            try (Statement stmt = conn.createStatement()) {\r
+                try (ResultSet rs = stmt.executeQuery("select SUBID, NODEID from EGRESS_ROUTES")) {\r
+                    while (rs.next()) {\r
+                        int subid = rs.getInt("SUBID");\r
+                        int nodeid = rs.getInt("NODEID");\r
+                        set.add(new EgressRoute(subid, nodeid));\r
+                    }\r
+                }\r
+            }\r
 \r
             db.release(conn);\r
         } catch (SQLException e) {\r
 \r
             db.release(conn);\r
         } catch (SQLException e) {\r
@@ -93,7 +94,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
             String sql = "select NODEID from EGRESS_ROUTES where SUBID = ?";\r
             ps = conn.prepareStatement(sql);\r
             ps.setInt(1, sub);\r
             String sql = "select NODEID from EGRESS_ROUTES where SUBID = ?";\r
             ps = conn.prepareStatement(sql);\r
             ps.setInt(1, sub);\r
-            try(ResultSet rs = ps.executeQuery()) {\r
+            try (ResultSet rs = ps.executeQuery()) {\r
                 if (rs.next()) {\r
                     int node = rs.getInt("NODEID");\r
                     v = new EgressRoute(sub, node);\r
                 if (rs.next()) {\r
                     int node = rs.getInt("NODEID");\r
                     v = new EgressRoute(sub, node);\r
@@ -105,7 +106,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -143,7 +144,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -168,10 +169,9 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
             rv = true;\r
         } catch (SQLException e) {\r
             intlogger.warn("PROV0005 doInsert: " + e.getMessage());\r
             rv = true;\r
         } catch (SQLException e) {\r
             intlogger.warn("PROV0005 doInsert: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -194,10 +194,9 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -221,8 +220,9 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
 \r
     @Override\r
     public boolean equals(Object obj) {\r
 \r
     @Override\r
     public boolean equals(Object obj) {\r
-        if (!(obj instanceof EgressRoute))\r
+        if (!(obj instanceof EgressRoute)) {\r
             return false;\r
             return false;\r
+        }\r
         EgressRoute on = (EgressRoute) obj;\r
         return (subid == on.subid) && (nodeid == on.nodeid);\r
     }\r
         EgressRoute on = (EgressRoute) obj;\r
         return (subid == on.subid) && (nodeid == on.nodeid);\r
     }\r
index 334863d..f187342 100644 (file)
@@ -683,7 +683,6 @@ public class Feed extends Syncable {
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
                 if (ps != null)\r
         } finally {\r
             try {\r
                 if (ps != null)\r
@@ -716,7 +715,6 @@ public class Feed extends Syncable {
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
                 if(ps!=null) {\r
         } finally {\r
             try {\r
                 if(ps!=null) {\r
index 6b390c4..033b390 100644 (file)
@@ -52,6 +52,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB;
  * @version $Id: IngressRoute.java,v 1.3 2013/12/16 20:30:23 eby Exp $\r
  */\r
 public class IngressRoute extends NodeClass implements Comparable<IngressRoute> {\r
  * @version $Id: IngressRoute.java,v 1.3 2013/12/16 20:30:23 eby Exp $\r
  */\r
 public class IngressRoute extends NodeClass implements Comparable<IngressRoute> {\r
+\r
     private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
     private final int seq;\r
     private final int feedid;\r
     private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");\r
     private final int seq;\r
     private final int feedid;\r
@@ -76,7 +77,8 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
      * @return a set of IngressRoutes\r
      */\r
     public static Set<IngressRoute> getIngressRoutesForSeq(int seq) {\r
      * @return a set of IngressRoutes\r
      */\r
     public static Set<IngressRoute> getIngressRoutesForSeq(int seq) {\r
-        return getAllIngressRoutesForSQL("select SEQUENCE, FEEDID, USERID, SUBNET, NODESET from INGRESS_ROUTES where SEQUENCE = " + seq);\r
+        return getAllIngressRoutesForSQL(\r
+                "select SEQUENCE, FEEDID, USERID, SUBNET, NODESET from INGRESS_ROUTES where SEQUENCE = " + seq);\r
     }\r
 \r
     private static SortedSet<IngressRoute> getAllIngressRoutesForSQL(String sql) {\r
     }\r
 \r
     private static SortedSet<IngressRoute> getAllIngressRoutesForSQL(String sql) {\r
@@ -85,8 +87,8 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-            try(Statement stmt = conn.createStatement()) {\r
-                try(ResultSet rs = stmt.executeQuery(sql)) {\r
+            try (Statement stmt = conn.createStatement()) {\r
+                try (ResultSet rs = stmt.executeQuery(sql)) {\r
                     while (rs.next()) {\r
                         int seq = rs.getInt("SEQUENCE");\r
                         int feedid = rs.getInt("FEEDID");\r
                     while (rs.next()) {\r
                         int seq = rs.getInt("SEQUENCE");\r
                         int feedid = rs.getInt("FEEDID");\r
@@ -128,12 +130,12 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-            try(Statement stmt = conn.createStatement()) {\r
-               try(ResultSet rs = stmt.executeQuery(sql)) {\r
-                   if (rs.next()) {\r
-                       rv = rs.getInt("MAX");\r
-                   }\r
-               }\r
+            try (Statement stmt = conn.createStatement()) {\r
+                try (ResultSet rs = stmt.executeQuery(sql)) {\r
+                    if (rs.next()) {\r
+                        rv = rs.getInt("MAX");\r
+                    }\r
+                }\r
             }\r
             db.release(conn);\r
         } catch (SQLException e) {\r
             }\r
             db.release(conn);\r
         } catch (SQLException e) {\r
@@ -146,7 +148,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
      * Get an Ingress Route for a particular feed ID, user, and subnet\r
      *\r
      * @param feedid the Feed ID to look for\r
      * Get an Ingress Route for a particular feed ID, user, and subnet\r
      *\r
      * @param feedid the Feed ID to look for\r
-     * @param user   the user name to look for\r
+     * @param user the user name to look for\r
      * @param subnet the subnet to look for\r
      * @return the Ingress Route, or null of there is none\r
      */\r
      * @param subnet the subnet to look for\r
      * @return the Ingress Route, or null of there is none\r
      */\r
@@ -162,7 +164,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             ps.setInt(1, feedid);\r
             ps.setString(2, user);\r
             ps.setString(3, subnet);\r
             ps.setInt(1, feedid);\r
             ps.setString(2, user);\r
             ps.setString(3, subnet);\r
-            try(ResultSet rs = ps.executeQuery()) {\r
+            try (ResultSet rs = ps.executeQuery()) {\r
                 if (rs.next()) {\r
                     int seq = rs.getInt("SEQUENCE");\r
                     int nodeset = rs.getInt("NODESET");\r
                 if (rs.next()) {\r
                     int seq = rs.getInt("SEQUENCE");\r
                     int nodeset = rs.getInt("NODESET");\r
@@ -175,7 +177,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
             intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -198,9 +200,9 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             String sql = "select FEEDID, USERID, SUBNET, NODESET from INGRESS_ROUTES where SEQUENCE = ?";\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             String sql = "select FEEDID, USERID, SUBNET, NODESET from INGRESS_ROUTES where SEQUENCE = ?";\r
-            try(PreparedStatement ps = conn.prepareStatement(sql)) {\r
+            try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
                 ps.setInt(1, seq);\r
                 ps.setInt(1, seq);\r
-                try(ResultSet rs = ps.executeQuery()) {\r
+                try (ResultSet rs = ps.executeQuery()) {\r
                     while (rs.next()) {\r
                         int feedid = rs.getInt("FEEDID");\r
                         String user = rs.getString("USERID");\r
                     while (rs.next()) {\r
                         int feedid = rs.getInt("FEEDID");\r
                         String user = rs.getString("USERID");\r
@@ -239,12 +241,14 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
         this.subnet = (subnet == null) ? "-" : subnet;\r
         this.nodelist = -1;\r
         this.nodes = null;\r
         this.subnet = (subnet == null) ? "-" : subnet;\r
         this.nodelist = -1;\r
         this.nodes = null;\r
-        if (Feed.getFeedById(feedid) == null)\r
+        if (Feed.getFeedById(feedid) == null) {\r
             throw new IllegalArgumentException("No such feed: " + feedid);\r
             throw new IllegalArgumentException("No such feed: " + feedid);\r
+        }\r
         if (!this.subnet.equals("-")) {\r
             SubnetMatcher sm = new SubnetMatcher(subnet);\r
         if (!this.subnet.equals("-")) {\r
             SubnetMatcher sm = new SubnetMatcher(subnet);\r
-            if (!sm.isValid())\r
+            if (!sm.isValid()) {\r
                 throw new IllegalArgumentException("Invalid subnet: " + subnet);\r
                 throw new IllegalArgumentException("Invalid subnet: " + subnet);\r
+            }\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -258,37 +262,41 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
         this.nodelist = -1;\r
         this.nodes = new TreeSet<String>();\r
         JSONArray ja = jo.getJSONArray("node");\r
         this.nodelist = -1;\r
         this.nodes = new TreeSet<String>();\r
         JSONArray ja = jo.getJSONArray("node");\r
-        for (int i = 0; i < ja.length(); i++)\r
+        for (int i = 0; i < ja.length(); i++) {\r
             this.nodes.add(ja.getString(i));\r
             this.nodes.add(ja.getString(i));\r
+        }\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * Does this particular IngressRoute match a request, represented by feedid and req?\r
-     * To match, <i>feedid</i> must match the feed ID in the route, the user in the route\r
-     * (if specified) must match the user in the request, and the subnet in the route (if specified)\r
-     * must match the subnet from the request.\r
+     * Does this particular IngressRoute match a request, represented by feedid and req? To match, <i>feedid</i> must\r
+     * match the feed ID in the route, the user in the route (if specified) must match the user in the request, and the\r
+     * subnet in the route (if specified) must match the subnet from the request.\r
      *\r
      * @param feedid the feedid for this request\r
      *\r
      * @param feedid the feedid for this request\r
-     * @param req    the remainder of the request\r
+     * @param req the remainder of the request\r
      * @return true if a match, false otherwise\r
      */\r
     public boolean matches(int feedid, HttpServletRequest req) {\r
         // Check feedid\r
      * @return true if a match, false otherwise\r
      */\r
     public boolean matches(int feedid, HttpServletRequest req) {\r
         // Check feedid\r
-        if (this.feedid != feedid)\r
+        if (this.feedid != feedid) {\r
             return false;\r
             return false;\r
+        }\r
 \r
         // Get user from request and compare\r
         // Note: we don't check the password; the node will do that\r
         if (userid.length() > 0 && !userid.equals("-")) {\r
             String credentials = req.getHeader("Authorization");\r
 \r
         // Get user from request and compare\r
         // Note: we don't check the password; the node will do that\r
         if (userid.length() > 0 && !userid.equals("-")) {\r
             String credentials = req.getHeader("Authorization");\r
-            if (credentials == null || !credentials.startsWith("Basic "))\r
+            if (credentials == null || !credentials.startsWith("Basic ")) {\r
                 return false;\r
                 return false;\r
+            }\r
             String t = new String(Base64.decodeBase64(credentials.substring(6)));\r
             int ix = t.indexOf(':');\r
             String t = new String(Base64.decodeBase64(credentials.substring(6)));\r
             int ix = t.indexOf(':');\r
-            if (ix >= 0)\r
+            if (ix >= 0) {\r
                 t = t.substring(0, ix);\r
                 t = t.substring(0, ix);\r
-            if (!t.equals(this.userid))\r
+            }\r
+            if (!t.equals(this.userid)) {\r
                 return false;\r
                 return false;\r
+            }\r
         }\r
 \r
         // If this route has a subnet, match it against the requester's IP addr\r
         }\r
 \r
         // If this route has a subnet, match it against the requester's IP addr\r
@@ -305,10 +313,11 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * Compare IP addresses as byte arrays to a subnet specified as a CIDR.\r
-     * Taken from org.onap.dmaap.datarouter.node.SubnetMatcher and modified somewhat.\r
+     * Compare IP addresses as byte arrays to a subnet specified as a CIDR. Taken from\r
+     * org.onap.dmaap.datarouter.node.SubnetMatcher and modified somewhat.\r
      */\r
     public class SubnetMatcher {\r
      */\r
     public class SubnetMatcher {\r
+\r
         private byte[] sn;\r
         private int len;\r
         private int mask;\r
         private byte[] sn;\r
         private int len;\r
         private int mask;\r
@@ -386,9 +395,9 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             String sql = "select NODEID from NODESETS where SETID = ?";\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
             String sql = "select NODEID from NODESETS where SETID = ?";\r
-            try(PreparedStatement ps = conn.prepareStatement(sql)) {\r
+            try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
                 ps.setInt(1, nodelist);\r
                 ps.setInt(1, nodelist);\r
-                try(ResultSet rs = ps.executeQuery()) {\r
+                try (ResultSet rs = ps.executeQuery()) {\r
                     while (rs.next()) {\r
                         int id = rs.getInt("NODEID");\r
                         set.add(lookupNodeID(id));\r
                     while (rs.next()) {\r
                         int id = rs.getInt("NODEID");\r
                         set.add(lookupNodeID(id));\r
@@ -425,10 +434,9 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0007 doDelete: " + e.getMessage());\r
         } catch (SQLException e) {\r
             rv = false;\r
             intlogger.warn("PROV0007 doDelete: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -457,7 +465,8 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             }\r
 \r
             // Create the INGRESS_ROUTES row\r
             }\r
 \r
             // Create the INGRESS_ROUTES row\r
-            ps = c.prepareStatement("insert into INGRESS_ROUTES (SEQUENCE, FEEDID, USERID, SUBNET, NODESET) values (?, ?, ?, ?, ?)");\r
+            ps = c.prepareStatement(\r
+                    "insert into INGRESS_ROUTES (SEQUENCE, FEEDID, USERID, SUBNET, NODESET) values (?, ?, ?, ?, ?)");\r
             ps.setInt(1, this.seq);\r
             ps.setInt(2, this.feedid);\r
             ps.setString(3, this.userid);\r
             ps.setInt(1, this.seq);\r
             ps.setInt(2, this.feedid);\r
             ps.setString(3, this.userid);\r
@@ -468,10 +477,9 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
             rv = true;\r
         } catch (SQLException e) {\r
             intlogger.warn("PROV0005 doInsert: " + e.getMessage());\r
             rv = true;\r
         } catch (SQLException e) {\r
             intlogger.warn("PROV0005 doInsert: " + e.getMessage());\r
-            intlogger.error("SQLException " + e.getMessage());\r
         } finally {\r
             try {\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -491,10 +499,12 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
         JSONObject jo = new JSONObject();\r
         jo.put("feedid", feedid);\r
         // Note: for user and subnet, null, "", and "-" are equivalent\r
         JSONObject jo = new JSONObject();\r
         jo.put("feedid", feedid);\r
         // Note: for user and subnet, null, "", and "-" are equivalent\r
-        if (userid != null && !userid.equals("-") && !userid.equals(""))\r
+        if (userid != null && !userid.equals("-") && !userid.equals("")) {\r
             jo.put("user", userid);\r
             jo.put("user", userid);\r
-        if (subnet != null && !subnet.equals("-") && !subnet.equals(""))\r
+        }\r
+        if (subnet != null && !subnet.equals("-") && !subnet.equals("")) {\r
             jo.put("subnet", subnet);\r
             jo.put("subnet", subnet);\r
+        }\r
         jo.put("seq", seq);\r
         jo.put("node", nodes);\r
         return jo;\r
         jo.put("seq", seq);\r
         jo.put("node", nodes);\r
         return jo;\r
@@ -502,7 +512,8 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
 \r
     @Override\r
     public String getKey() {\r
 \r
     @Override\r
     public String getKey() {\r
-        return String.format("%d/%s/%s/%d", feedid, (userid == null) ? "" : userid, (subnet == null) ? "" : subnet, seq);\r
+        return String\r
+                .format("%d/%s/%s/%d", feedid, (userid == null) ? "" : userid, (subnet == null) ? "" : subnet, seq);\r
     }\r
 \r
     @Override\r
     }\r
 \r
     @Override\r
@@ -513,8 +524,9 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
     @Override\r
     public boolean equals(Object obj) {\r
         try {\r
     @Override\r
     public boolean equals(Object obj) {\r
         try {\r
-            if (!(obj instanceof IngressRoute))\r
+            if (!(obj instanceof IngressRoute)) {\r
                 return false;\r
                 return false;\r
+            }\r
             return this.compareTo((IngressRoute) obj) == 0;\r
         } catch (NullPointerException e) {\r
             return false;\r
             return this.compareTo((IngressRoute) obj) == 0;\r
         } catch (NullPointerException e) {\r
             return false;\r
@@ -523,25 +535,31 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute>
 \r
     @Override\r
     public int compareTo(IngressRoute in) {\r
 \r
     @Override\r
     public int compareTo(IngressRoute in) {\r
-        if (in == null)\r
+        if (in == null) {\r
             throw new NullPointerException();\r
             throw new NullPointerException();\r
+        }\r
         int n = this.feedid - in.feedid;\r
         int n = this.feedid - in.feedid;\r
-        if (n != 0)\r
+        if (n != 0) {\r
             return n;\r
             return n;\r
+        }\r
         n = this.seq - in.seq;\r
         n = this.seq - in.seq;\r
-        if (n != 0)\r
+        if (n != 0) {\r
             return n;\r
             return n;\r
+        }\r
         n = this.userid.compareTo(in.userid);\r
         n = this.userid.compareTo(in.userid);\r
-        if (n != 0)\r
+        if (n != 0) {\r
             return n;\r
             return n;\r
+        }\r
         n = this.subnet.compareTo(in.subnet);\r
         n = this.subnet.compareTo(in.subnet);\r
-        if (n != 0)\r
+        if (n != 0) {\r
             return n;\r
             return n;\r
+        }\r
         return this.nodes.equals(in.nodes) ? 0 : 1;\r
     }\r
 \r
     @Override\r
     public String toString() {\r
         return this.nodes.equals(in.nodes) ? 0 : 1;\r
     }\r
 \r
     @Override\r
     public String toString() {\r
-        return String.format("INGRESS: feed=%d, userid=%s, subnet=%s, seq=%d", feedid, (userid == null) ? "" : userid, (subnet == null) ? "" : subnet, seq);\r
+        return String.format("INGRESS: feed=%d, userid=%s, subnet=%s, seq=%d", feedid, (userid == null) ? "" : userid,\r
+                (subnet == null) ? "" : subnet, seq);\r
     }\r
 }\r
     }\r
 }\r