markap14 commented on a change in pull request #3559: NIFI-1624 Allow
ExtractText processor to fail if max. capture group l…
URL: https://github.com/apache/nifi/pull/3559#discussion_r314056157
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExtractText.java
##########
@@ -218,6 +243,13 @@
.description("FlowFiles are routed to this relationship when no
provided Regular Expression matches the content of the FlowFile")
.build();
+ public static final Relationship FAILURE = new Relationship.Builder()
Review comment:
The problem with introducing a new Relationship is that it means that any
existing flow that uses this processor would now end up with the processor
being invalid. While this is not always an absolute deal breaker, making a
processor invalid during an upgrade is usually reserved for problems that work
around critical bugs, etc. The preferred method would be to implement the
`onPropertyModified` method to keep track of whether the "Capture Group Length
Excess Policy" property is set to Fail or Truncate. Then, override the
`getRelationships` method and only include the failure relationship if that
property is set to Fail. There are a couple of processors that do this or
something similar already, but I cannot tell you which ones off the top of my
head.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services