From baea7ffee943009f5bf178dedf7f6e0de5bfc9ae Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Mon, 21 Aug 2023 10:17:53 -0400 Subject: [PATCH] NIFI-11971: Ensure that when creating a new content claim that we always treat an existing claim length of -1 as 0, to ensure that we never add -1 to our offset This closes #7631 Signed-off-by: David Handermann --- .../apache/nifi/controller/repository/FileSystemRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java index bb2da2f224..38d53ea700 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java @@ -1977,7 +1977,7 @@ public class FileSystemRepository implements ContentRepository { @Override public synchronized ContentClaim newContentClaim() throws IOException { - scc = new StandardContentClaim(scc.getResourceClaim(), scc.getOffset() + scc.getLength()); + scc = new StandardContentClaim(scc.getResourceClaim(), scc.getOffset() + Math.max(0, scc.getLength())); initialLength = 0; bytesWritten = 0L; incrementClaimaintCount(scc);