ijokarumawak commented on a change in pull request #3375: NIFI-5979 : enhanced
ReplaceText processor with "Number of Occurrences" and "Occurrence offset"
configurations
URL: https://github.com/apache/nifi/pull/3375#discussion_r270276284
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java
##########
@@ -586,52 +672,76 @@ public void process(final InputStream in, final
OutputStream out) throws IOExcep
try (final LineDemarcator demarcator = new
LineDemarcator(in, charset, maxBufferSize, 8192);
final BufferedWriter bw = new BufferedWriter(new
OutputStreamWriter(out, charset))) {
- String oneLine;
- final StringBuffer sb = new StringBuffer();
+// final StringBuffer sb = new StringBuffer();
Matcher matcher = null;
-
- while (null != (oneLine = demarcator.nextLine())) {
- additionalAttrs.clear();
- if (matcher == null) {
- matcher = searchPattern.matcher(oneLine);
+ String precedingLine = demarcator.nextLine();
Review comment:
These lines of code can be seen in each `ReplacementStrategyExecutor`
implementations and it makes harder to maintain. Please try consolidating them
by making this logic around Evaluation modes to a shared common method.
For example, by extracting these lines to a method and pass the each
ReplacementStrategyExecutor specific part as a function.
----------------------------------------------------------------
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