فهرست منبع

fixed issue #2129 , Negative seek offset

agapple 5 سال پیش
والد
کامیت
ecdab76705
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      common/src/main/java/com/alibaba/otter/canal/common/utils/FileUtils.java

+ 4 - 1
common/src/main/java/com/alibaba/otter/canal/common/utils/FileUtils.java

@@ -28,10 +28,13 @@ public class FileUtils {
                 minIndex = 0;
             }
 
-            String line;
+            if (readIndex < 0) {
+                readIndex = 0;
+            }
             rf.seek(readIndex);
             int k = 0;
             int c = -1;
+            String line = null;
             while (readIndex > start) {
                 if (k == l) {
                     break;