rawlinp commented on a change in pull request #2785: In Traffic Router Support 
Snapshots which only update Delivery Services
URL: https://github.com/apache/trafficcontrol/pull/2785#discussion_r239965999
 
 

 ##########
 File path: 
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/util/JsonUtils.java
 ##########
 @@ -123,10 +124,58 @@ public static JsonNode getJsonNode(final JsonNode 
jsonNode, final String key) th
         if (jsonNode == null || !jsonNode.has(key)) {
             throwException(key);
         }
-
         return jsonNode.get(key);
     }
 
+    public static boolean equalSubtrees(final JsonNode root1, final JsonNode 
root2, final String key) throws JsonUtilsException {
+        if (root1 == null || root2 == null) {
+            throwException(key);
+        }
+
+        final JsonNode sub1 = root1.get(key);
+        final JsonNode sub2 = root2.get(key);
+
+        if ((sub1==null && sub2 !=null) || (sub1!=null && sub2==null)) {
+            return false;
+        }
+        if (sub1==null) {
+            return true;
+        }
+        return sub1.equals(sub2);
+    }
+
+    @SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
+            public static boolean equalSubtreesExcept(final JsonNode root1, 
final JsonNode root2, final String key,
 
 Review comment:
   too much indentation

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to