null-safe DocPath ancentry tests

Change-Id: I36709bee94b10e516427adb892d1caeabea1b9aa
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
index ed5de9f..8c969aa 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
@@ -172,7 +172,8 @@
      * @return {@code true} is yes; {@code false} otherwise.
      */
     public boolean isAncestorOf(DocumentPath other) {
-        return this.pathElements.size() < other.pathElements.size() &&
+        return other != null &&
+               this.pathElements.size() < other.pathElements.size() &&
                this.pathElements.equals(other.pathElements.subList(0, this.pathElements.size()));
     }
 
@@ -186,7 +187,8 @@
      * @return {@code true} is yes; {@code false} otherwise.
      */
     public boolean isDescendentOf(DocumentPath other) {
-        return other.equals(this) || other.isAncestorOf(this);
+        return other != null &&
+               (other.equals(this) || other.isAncestorOf(this));
     }
 
     /**
diff --git a/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java b/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
index 19c34bd..431f58f 100644
--- a/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
+++ b/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
@@ -60,6 +60,9 @@
         assertTrue(path3.isDescendentOf(path3));
         assertTrue(path3.isDescendentOf(path1));
         assertFalse(path3.isDescendentOf(path2));
+
+        assertFalse(path.isDescendentOf(null));
+        assertFalse(path.isAncestorOf(null));
     }
 
     @Rule