You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/08/21 20:08:20 UTC

[nifi] 02/04: 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 is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch NIFI-11972-RC1
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 7d82b94c66fe0e774b3ff3d764f27481bf76efff
Author: Mark Payne <ma...@hotmail.com>
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 <ex...@apache.org>
    (cherry picked from commit baea7ffee943009f5bf178dedf7f6e0de5bfc9ae)
---
 .../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 0e94cdab6d..e02bfcd6bd 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
@@ -1970,7 +1970,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);