[ https://issues.apache.org/jira/browse/NIFI-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947884#comment-14947884 ]
Mark Payne commented on NIFI-447: --------------------------------- [~JPercivall] it looks like you mentioned Michael Payne in the last comment, not me :) Patch looks really good now. I did find one bug related to the character set. There were two places where it was calling getBytes() without passing in the appropriate character set. I went ahead and addressed those in a new patch. I also fixed a couple of typos in the documentation and (at least I think) clarified a bit of the documentation. There were also a couple of performance improvements that I noticed could be implemented. For example, since it's running over a few FlowFiles in each iteration of onTrigger, I created a single byte array and reuse it rather than creating a new byte array for each FlowFile. I also noticed that for the Literal Replace, it was using a regular expression in order to insert the Replacement Value before the line ending. This definitely appears to work okay but can be pretty expensive, especially since the regex starts with a .* which is a very expensive operation to perform in regex land. So I changed it a bit to just copy the data character-by-character from the (buffered) input stream to the (buffered) output stream until we find a \r or a \n and at that point write out the replacement value, and then write out the rest of the characters. I added unit tests for this to ensure that it's working right, and all of the existing tests that you created pass as well. I attached a new patch with these things merged in. Please review and make sure that you're okay with the changes that I made. Thanks -Mark > Add "Replacement Strategy" property to ReplaceText > -------------------------------------------------- > > Key: NIFI-447 > URL: https://issues.apache.org/jira/browse/NIFI-447 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions > Reporter: Mark Payne > Fix For: 0.4.0 > > Attachments: > 0001-NIFI-447-Fixed-some-typos-and-clarified-some-documen.patch, > NIFI-447.patch > > > "Regular Expression" property should have displayName changed to "Search > Value" > ReplaceText should allow for a "Replacement Strategy" with values: > Prepend (Search Value is ignored; replacement value prepended to FlowFile) > Append (Search Value is ignored; replacement value appended to FlowFIle) > Regex Replace (current behavior, so this should be default) > Linewise Regex Replace (like current behavior if Evaluation Mode is set to > Line-by-Line) > Literal Replace (do not interpret the Replacement value > The Line-by-Line property should be removed; this is breaking change! -- This message was sent by Atlassian JIRA (v6.3.4#6332)