Github user mosermw commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2748#discussion_r193232920
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
---
@@ -1074,12 +1090,11 @@ public void testRegexWithBadCaptureGroup() throws
IOException {
runner.setProperty(ReplaceText.REPLACEMENT_STRATEGY,
ReplaceText.REGEX_REPLACE);
runner.setProperty(ReplaceText.EVALUATION_MODE,
ReplaceText.ENTIRE_TEXT);
+ exception.expect(AssertionError.class);
+ exception.expectMessage("java.lang.IndexOutOfBoundsException: No
group 1");
--- End diff --
At first I was really concerned about this change to
IndexOutOfBoundsException, because it means the flowfile will rollback and
admin yield the ReplaceText. But if this is simply verifying behavior when the
SEARCH_VALUE is incorrectly configured, then I think this is OK. Can you
confirm? Normally we would prefer a customValidate() method catch this
scenario (REPLACEMENT_VALUE references a capture group that does exist in the
SEARCH_VALUE) but perhaps that isn't viable at validation time.
---