Created 01-30-2017 04:46 PM
2017-01-30 16:38:39,425 WARN [Timer-Driven Process Thread-9] o.a.n.c.t.ContinuallyRunProcessorTask java.lang.IndexOutOfBoundsException: No group 1 at java.util.regex.Matcher.start(Matcher.java:375) ~[na:1.8.0_77] at java.util.regex.Matcher.appendReplacement(Matcher.java:880) ~[na:1.8.0_77] at java.util.regex.Matcher.replaceAll(Matcher.java:955) ~[na:1.8.0_77] at java.lang.String.replaceAll(String.java:2223) ~[na:1.8.0_77] at org.apache.nifi.processors.standard.ReplaceText$RegexReplace.replace(ReplaceText.java:518) ~[na:na] at org.apache.nifi.processors.standard.ReplaceText.onTrigger(ReplaceText.java:263) ~[na:na] at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) ~[nifi-api-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2] at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099) ~[nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2] at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_77] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_77] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_77] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
Created on 02-01-2017 10:46 PM - edited 08-18-2019 05:45 AM
I don't have a solution, yet, but I think that ReplaceText is doing recursive replacement of some sort. It is replacing the value with the requested attribute, but it is then evaluating that replacement again, including a new $2, but there is no group 2 captured in the search.
I find that this happens if the attribute I'm replacing has a dollar sign followed by a number in it. For instance, the following replace text is going to put the user.name attribute into the flowfile:
However, when the attribute has a $2 in it, I get an IndexOutOfBounds error and the offending flowfile stays in the upstream queue.
Here are the flowfile attributes that show a $2 in the middle of the user.name attribute.
I get the same issue with "no group 6" if the name has $6 in it.
I'm going to try some of the quoting functions to see if that changes the behavior.
John
Created 01-30-2017 05:12 PM
Tim,
It looks like the regex you're using might need more work to account for optional matches. The ReplaceText processor is complaining about missing match groups and has no context to do the replacement.
Created on 02-01-2017 10:46 PM - edited 08-18-2019 05:45 AM
I don't have a solution, yet, but I think that ReplaceText is doing recursive replacement of some sort. It is replacing the value with the requested attribute, but it is then evaluating that replacement again, including a new $2, but there is no group 2 captured in the search.
I find that this happens if the attribute I'm replacing has a dollar sign followed by a number in it. For instance, the following replace text is going to put the user.name attribute into the flowfile:
However, when the attribute has a $2 in it, I get an IndexOutOfBounds error and the offending flowfile stays in the upstream queue.
Here are the flowfile attributes that show a $2 in the middle of the user.name attribute.
I get the same issue with "no group 6" if the name has $6 in it.
I'm going to try some of the quoting functions to see if that changes the behavior.
John