You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2020/02/25 13:24:26 UTC

[incubator-iotdb] branch FileClosedDebug updated: s

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

jackietien pushed a commit to branch FileClosedDebug
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/FileClosedDebug by this push:
     new 5ba9fe5  s
5ba9fe5 is described below

commit 5ba9fe508b6a2984f296328894856e8a7abfaace
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Tue Feb 25 21:24:11 2020 +0800

    s
---
 .../org/apache/iotdb/tsfile/read/reader/DefaultTsFileInput.java  | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/DefaultTsFileInput.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/DefaultTsFileInput.java
index 0bdb408..b29dcd2 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/DefaultTsFileInput.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/DefaultTsFileInput.java
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
-import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
@@ -68,14 +67,10 @@ public class DefaultTsFileInput implements TsFileInput {
   @Override
   public int read(ByteBuffer dst, long position) throws IOException {
     if (!channel.isOpen()) {
-      channel = FileChannel.open(path, StandardOpenOption.READ);
-    }
-    try {
-      return channel.read(dst, position);
-    } catch (ClosedChannelException e) {
       LOGGER.error("File is closed while reading {}", path.toString());
-      throw e;
+      channel = FileChannel.open(path, StandardOpenOption.READ);
     }
+    return channel.read(dst, position);
   }
 
   @Override