diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeleteFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeleteFile.java index 4980e291d2..ae885ea2e4 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeleteFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeleteFile.java @@ -21,8 +21,6 @@ import org.apache.nifi.annotation.behavior.InputRequirement; import org.apache.nifi.annotation.behavior.Restricted; import org.apache.nifi.annotation.behavior.Restriction; import org.apache.nifi.annotation.behavior.SupportsBatching; -import org.apache.nifi.annotation.behavior.WritesAttribute; -import org.apache.nifi.annotation.behavior.WritesAttributes; import org.apache.nifi.annotation.documentation.CapabilityDescription; import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.annotation.documentation.UseCase; @@ -60,17 +58,6 @@ import java.util.concurrent.TimeUnit; Using 'DeleteFile', delete the file from the filesystem only after the result has been stored. """ ) -@WritesAttributes({ - @WritesAttribute( - attribute = DeleteFile.ATTRIBUTE_FAILURE_REASON, - description = "Human-readable reason of failure. Only available if FlowFile is routed to relationship 'failure'."), - @WritesAttribute( - attribute = DeleteFile.ATTRIBUTE_EXCEPTION_CLASS, - description = "The class name of the exception thrown during processor execution. Only available if an exception caused the FlowFile to be routed to relationship 'failure'."), - @WritesAttribute( - attribute = DeleteFile.ATTRIBUTE_EXCEPTION_MESSAGE, - description = "The message of the exception thrown during processor execution. Only available if an exception caused the FlowFile to be routed to relationship 'failure'.") -}) @Restricted( restrictions = { @Restriction( @@ -83,10 +70,6 @@ import java.util.concurrent.TimeUnit; ) public class DeleteFile extends AbstractProcessor { - public static final String ATTRIBUTE_FAILURE_REASON = "DeleteFile.failure.reason"; - public static final String ATTRIBUTE_EXCEPTION_CLASS = "DeleteFile.failure.exception.class"; - public static final String ATTRIBUTE_EXCEPTION_MESSAGE = "DeleteFile.failure.exception.message"; - public static final Relationship REL_SUCCESS = new Relationship.Builder() .name("success") .description("All FlowFiles, for which an existing file has been deleted, are routed to this relationship") @@ -177,11 +160,6 @@ public class DeleteFile extends AbstractProcessor { private void handleFailure(ProcessSession session, FlowFile flowFile, String errorMessage, Throwable throwable) { getLogger().error(errorMessage, throwable); - session.putAttribute(flowFile, ATTRIBUTE_FAILURE_REASON, errorMessage); - if (throwable != null) { - session.putAttribute(flowFile, ATTRIBUTE_EXCEPTION_CLASS, throwable.getClass().toString()); - session.putAttribute(flowFile, ATTRIBUTE_EXCEPTION_MESSAGE, throwable.getMessage()); - } session.penalize(flowFile); session.transfer(flowFile, REL_FAILURE); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestDeleteFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestDeleteFile.java index 461d359b51..bbe10dd404 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestDeleteFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestDeleteFile.java @@ -114,10 +114,6 @@ class TestDeleteFile { assertExists(fileToDelete); runner.assertAllFlowFilesTransferred(DeleteFile.REL_FAILURE); runner.assertPenalizeCount(1); - final MockFlowFile resultFlowFile = runner.getFlowFilesForRelationship(DeleteFile.REL_FAILURE).getFirst(); - resultFlowFile.assertAttributeExists(DeleteFile.ATTRIBUTE_FAILURE_REASON); - resultFlowFile.assertAttributeExists(DeleteFile.ATTRIBUTE_EXCEPTION_CLASS); - resultFlowFile.assertAttributeExists(DeleteFile.ATTRIBUTE_EXCEPTION_MESSAGE); } @Test @@ -133,10 +129,6 @@ class TestDeleteFile { assertExists(fileToDelete); runner.assertAllFlowFilesTransferred(DeleteFile.REL_FAILURE, 1); runner.assertPenalizeCount(1); - final MockFlowFile resultFlowFile = runner.getFlowFilesForRelationship(DeleteFile.REL_FAILURE).getFirst(); - resultFlowFile.assertAttributeExists(DeleteFile.ATTRIBUTE_FAILURE_REASON); - resultFlowFile.assertAttributeNotExists(DeleteFile.ATTRIBUTE_EXCEPTION_CLASS); - resultFlowFile.assertAttributeNotExists(DeleteFile.ATTRIBUTE_EXCEPTION_MESSAGE); } private MockFlowFile enqueue(String directoryPath, String filename) {