From c34f04b35ba2f528d7ebfd183f0826c2632a339b Mon Sep 17 00:00:00 2001 From: livehl Date: Wed, 12 Oct 2022 08:50:12 +0800 Subject: [PATCH] fix bug : read error when position after 2147483647 (#3829) Co-authored-by: huang.lin --- .../src/main/java/seaweedfs/client/SeaweedInputStream.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java index 9d1fb3417..64754321b 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java @@ -119,9 +119,8 @@ public class SeaweedInputStream extends InputStream { long bytesRead = 0; int len = buf.remaining(); - int start = (int) this.position; - if (start + len <= entry.getContent().size()) { - entry.getContent().substring(start, start + len).copyTo(buf); + if (this.position< Integer.MAX_VALUE && (this.position + len )<= entry.getContent().size()) { + entry.getContent().substring((int)this.position, (int)(this.position + len)).copyTo(buf); } else { bytesRead = SeaweedRead.read(this.filerClient, this.visibleIntervalList, this.position, buf, SeaweedRead.fileSize(entry)); }