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

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new baea7ffee9 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
baea7ffee9 is described below

commit baea7ffee943009f5bf178dedf7f6e0de5bfc9ae
Author: Mark Payne <[email protected]>
AuthorDate: Mon Aug 21 10:17:53 2023 -0400

    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 <[email protected]>
---
 .../org/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);

Reply via email to