You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by su...@apache.org on 2020/11/22 13:40:55 UTC

[iotdb] branch jira-1021-rel/0.10 created (now e343267)

This is an automated email from the ASF dual-hosted git repository.

sunzesong pushed a change to branch jira-1021-rel/0.10
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at e343267  [IOTDB-1021] [To rel/0.10] Fix NullPointerException when showing child paths of non-existent path

This branch includes the following new commits:

     new e343267  [IOTDB-1021] [To rel/0.10] Fix NullPointerException when showing child paths of non-existent path

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [IOTDB-1021] [To rel/0.10] Fix NullPointerException when showing child paths of non-existent path

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunzesong pushed a commit to branch jira-1021-rel/0.10
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e3432677e5c42ad59e39db892b6fb94ff5d1140a
Author: samperson1997 <sz...@mails.tsinghua.edu.cn>
AuthorDate: Sun Nov 22 21:40:28 2020 +0800

    [IOTDB-1021] [To rel/0.10] Fix NullPointerException when showing child paths of non-existent path
---
 server/src/main/java/org/apache/iotdb/db/metadata/MTree.java          | 3 +++
 .../src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index 5f38a23..d5caf38 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -743,6 +743,9 @@ public class MTree implements Serializable {
    */
   private void findChildNodePathInNextLevel(
       MNode node, String[] nodes, int idx, String parent, Set<String> res, int length) {
+    if (node == null) {
+      return;
+    }
     String nodeReg = MetaUtils.getNodeRegByIdx(idx, nodes);
     if (!nodeReg.contains(PATH_WILDCARD)) {
       if (idx == length) {
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
index 0725293..56349ca 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
@@ -371,7 +371,8 @@ public class MManagerBasicTest {
         "[root.laptop.b1.d1, root.laptop.b1.d2, root.vehicle.b1.d0, root.vehicle.b1.d2, root.vehicle.b1.d3]",
         "[root.laptop.b1.d1, root.laptop.b1.d2]",
         "[root.vehicle.b1.d0, root.vehicle.b1.d2, root.vehicle.b1.d3, root.vehicle.b2.d0]",
-        "[root.laptop.b1.d1.s0, root.laptop.b1.d1.s1, root.laptop.b1.d2.s0, root.laptop.b2.d1.s1, root.laptop.b2.d1.s3, root.laptop.b2.d2.s2]"
+        "[root.laptop.b1.d1.s0, root.laptop.b1.d1.s1, root.laptop.b1.d2.s0, root.laptop.b2.d1.s1, root.laptop.b2.d1.s3, root.laptop.b2.d2.s2]",
+        "[]"
     };
 
     try {
@@ -407,6 +408,7 @@ public class MManagerBasicTest {
       assertEquals(res[5], manager.getChildNodePathInNextLevel("root.l*.b1").toString());
       assertEquals(res[6], manager.getChildNodePathInNextLevel("root.v*.*").toString());
       assertEquals(res[7], manager.getChildNodePathInNextLevel("root.l*.b*.*").toString());
+      assertEquals(res[8], manager.getChildNodePathInNextLevel("root.laptopp").toString());
     } catch (MetadataException e) {
       e.printStackTrace();
       fail(e.getMessage());