You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Konstantin (JIRA)" <ji...@apache.org> on 2018/11/12 09:51:00 UTC
[jira] [Created] (NIFI-5813) ReplaceText regression: fails on mixed
literal dollar signs and backreferences
Konstantin created NIFI-5813:
--------------------------------
Summary: ReplaceText regression: fails on mixed literal dollar signs and backreferences
Key: NIFI-5813
URL: https://issues.apache.org/jira/browse/NIFI-5813
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 1.8.0
Reporter: Konstantin
Fix For: 1.7.1
We've got a bug with ReplaceText when in replacement value are both the literal dollar signs and backreferences.
Our use case is preparing Mongo queries using the value passed in FlowFile. The replacement looks like this:
{code:java}
{updatedTime: {$ne: $1}}
{code}
NiFi 1.7.1 iterates through this line ([source|https://github.com/apache/nifi/blob/rel/nifi-1.7.1/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java#L709]) and correctly replaces only "$ne", leaving "$1" untouched. NiFi 1.8.0, on the other hand, uses Matcher ([source|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java#L717]), which escapes all and every dollar sign if it ever finds the need to escape one, so the backreference is treated as literal replacement, and the query fails.
We have to make a workaround right now by using several ReplaceText processors in a row, but this looks rather ugly. Hoping to see this fixed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)