diff --git a/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java b/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java index b53310adcc..9467bfe6d7 100644 --- a/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java +++ b/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java @@ -277,7 +277,7 @@ public class ModifyCompression extends AbstractProcessor { session.transfer(flowFile, REL_SUCCESS); } catch (final RuntimeException e) { getLogger().error("Input Compression [{}] Size [{}] Output Compression [{}] Failed {}", - inputCompressionStrategy, inputFileSize, outputCompressionStrategy, flowFile); + inputCompressionStrategy, inputFileSize, outputCompressionStrategy, flowFile, e); session.transfer(flowFile, REL_FAILURE); } } diff --git a/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/test/java/org/apache/nifi/processors/compress/TestModifyCompression.java b/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/test/java/org/apache/nifi/processors/compress/TestModifyCompression.java index dc86fc1a6d..0f4aabddea 100644 --- a/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/test/java/org/apache/nifi/processors/compress/TestModifyCompression.java +++ b/nifi-nar-bundles/nifi-compress-bundle/nifi-compress-processors/src/test/java/org/apache/nifi/processors/compress/TestModifyCompression.java @@ -19,6 +19,7 @@ package org.apache.nifi.processors.compress; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.processors.compress.property.CompressionStrategy; import org.apache.nifi.processors.compress.property.FilenameStrategy; +import org.apache.nifi.util.LogMessage; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; @@ -28,9 +29,12 @@ import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Optional; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; class TestModifyCompression { @@ -292,6 +296,12 @@ class TestModifyCompression { runner.assertAllFlowFilesTransferred(ModifyCompression.REL_FAILURE, 1); runner.getFlowFilesForRelationship(ModifyCompression.REL_FAILURE).get(0).assertContentEquals(data); + + final LogMessage errorMessage = runner.getLogger().getErrorMessages().iterator().next(); + assertNotNull(errorMessage); + + final Optional exceptionFound = Arrays.stream(errorMessage.getArgs()).filter(Exception.class::isInstance).findFirst(); + assertTrue(exceptionFound.isPresent()); } @Test