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

[nifi] branch main updated: NIFI-9834: When calling ByteArrayContentRepository.read() on a null Content Claim, return an empty ByteArrayInputStream instead of throwing NullPointerException

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

turcsanyi 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 16c9bd5  NIFI-9834: When calling ByteArrayContentRepository.read() on a null Content Claim, return an empty ByteArrayInputStream instead of throwing NullPointerException
16c9bd5 is described below

commit 16c9bd535bebb1438f28c4ed1ec30f02cc994c60
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Fri Mar 25 14:10:21 2022 -0400

    NIFI-9834: When calling ByteArrayContentRepository.read() on a null Content Claim, return an empty ByteArrayInputStream instead of throwing NullPointerException
    
    This closes #5903.
    
    Signed-off-by: Peter Turcsanyi <tu...@apache.org>
---
 .../nifi/stateless/repository/ByteArrayContentRepository.java       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/ByteArrayContentRepository.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/ByteArrayContentRepository.java
index 39baaea..e32aa73 100644
--- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/ByteArrayContentRepository.java
+++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/ByteArrayContentRepository.java
@@ -215,12 +215,16 @@ public class ByteArrayContentRepository implements ContentRepository {
 
     @Override
     public InputStream read(final ContentClaim claim) {
+        if (claim == null) {
+            return new ByteArrayInputStream(new byte[0]);
+        }
+
         final ByteArrayContentClaim byteArrayContentClaim = verifyClaim(claim);
         return byteArrayContentClaim.read();
     }
 
     @Override
-    public InputStream read(final ResourceClaim claim) throws IOException {
+    public InputStream read(final ResourceClaim claim) {
         if (claim == null) {
             return new ByteArrayInputStream(new byte[0]);
         }