Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-5813

ReplaceText regression: fails on mixed literal dollar signs and backreferences

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.8.0
    • None
    • None

    Description

      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:

      {updatedTime: {$ne: $1}}
      

      NiFi 1.7.1 iterates through this line (source) and correctly replaces only "$ne", leaving "$1" untouched. NiFi 1.8.0, on the other hand, uses Matcher (source), 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.

      Attachments

        1. ReplaceText_regression.xml
          22 kB
          Konstantin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Cerberuser Konstantin
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: