You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/07/03 08:38:37 UTC

[iotdb] 01/01: fix take byte array null pointer

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

qiaojialin pushed a commit to branch fix_null_pointer_in_cluster_0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit a8154bdae456e088556aa1f9a262809e390adaae
Author: qiaojialin <64...@qq.com>
AuthorDate: Sat Jul 3 16:38:08 2021 +0800

    fix take byte array null pointer
---
 .../main/java/org/apache/iotdb/cluster/utils/PlanSerializer.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/PlanSerializer.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/PlanSerializer.java
index 71b3136..78200f0 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/PlanSerializer.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/PlanSerializer.java
@@ -35,7 +35,13 @@ public class PlanSerializer {
   }
 
   public byte[] serialize(PhysicalPlan plan) throws IOException {
-    ByteArrayOutputStream poll = baosBlockingDeque.poll();
+    ByteArrayOutputStream poll;
+    try {
+      poll = baosBlockingDeque.take();
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new IOException("take byte array output stream interrupted", e);
+    }
     poll.reset();
 
     try (DataOutputStream dataOutputStream = new DataOutputStream(poll)) {