From 6d68381ea46a4c8098dea4b937886b2459d0c10d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 27 Nov 2026 03:39:33 -0800 Subject: [PATCH] java client: fail a chunk fetch that answers a non-2xx status doFetchOneFullChunkData returned the response body whatever the status, so a 401 "wrong jwt" or a 404 JSON error was taken as chunk data and cached. Throw instead, so the fetch tries the next location and reports the error. Co-Authored-By: Claude Opus 5.5 --- .../client/src/main/java/seaweedfs/client/SeaweedRead.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java index 5948336850..4ff50c1c97 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java @@ -189,6 +189,11 @@ public class SeaweedRead { CloseableHttpResponse response = SeaweedUtil.getClosableHttpClient().execute(request); try { + int status = response.getStatusLine().getStatusCode(); + if (status / 100 != 2) { + throw new IOException("fetch " + url + ": " + response.getStatusLine()); + } + HttpEntity entity = response.getEntity(); Header contentEncodingHeader = entity.getContentEncoding();