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 <exceptionfactory@apache.org>
This commit is contained in:
Mark Payne 2023-08-21 10:17:53 -04:00 committed by exceptionfactory
parent 52cc831a2a
commit baea7ffee9
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
1 changed files with 1 additions and 1 deletions

View File

@ -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);