You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "David Handermann (Jira)" <ji...@apache.org> on 2025/10/07 21:41:00 UTC

[jira] [Commented] (NIFI-15044) ReplaceText processor java exception

    [ https://issues.apache.org/jira/browse/NIFI-15044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18028207#comment-18028207 ] 

David Handermann commented on NIFI-15044:
-----------------------------------------

Thanks for describing the issue and providing the stack trace [~Zenkovac].

It sounds like this is expected behavior. Expression Language snippets must be capable of handle input data, so if the timestamp format does not match expected input, that means the timestamp format needs to be changed. The reason for keeping the input data queued is that an exception from an Expression Language snippet is considered a programming issue with the flow configuration. Keeping the data queued provides the opportunity to make the correction and then proceed with processing, versus some other "expected" error.

> ReplaceText processor java exception
> ------------------------------------
>
>                 Key: NIFI-15044
>                 URL: https://issues.apache.org/jira/browse/NIFI-15044
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>            Reporter: Zenkovac
>            Priority: Major
>
> using ReplaceText processor with replacement strategy: regex replace.
> using a regex with capture group $1 and using this expression:
> "timefield":"${'$1':toDate("yyyy-MM-dd'T'HH:mm:ss"):format('yyyy-MM-dd HH:mm:ss')}
> if the time field in the message doesn't match the provided format, flowfile doesn't go to fail queue but instead nifi produces exception in log and halts the processor.
>  
> 2025-10-01 16:15:58,479 ERROR [Timer-Driven Process Thread-16] o.a.nifi.processors.standard.ReplaceText ReplaceText[id=4e56bdce-e2bf-3b83-aa50-ac80c1f8e2ea] Processing halted: yielding [1 sec]
> org.apache.nifi.attribute.expression.language.exception.IllegalAttributeException: Cannot parse attribute value as a date; date format: yyyy-MM-dd'T'HH:mm:ss; attribute value: 2025-09-27T06:45:00-03:00. Error: Text '2025-09-27T06:45:00-03:00' could not be parsed, unparsed text found at index 19
>         at org.apache.nifi.attribute.expression.language.evaluation.functions.StringToDateEvaluator.evaluate(StringToDateEvaluator.java:101)
>         at org.apache.nifi.attribute.expression.language.evaluation.functions.FormatEvaluator.evaluate(FormatEvaluator.java:71)
>         at org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:460)
>         at org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:223)
>         at org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
>         at org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:59)
>         at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:176)
>         at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:163)
>         at org.apache.nifi.processors.standard.ReplaceText$RegexReplace.lambda$replace$3(ReplaceText.java:673)
>         at org.apache.nifi.processors.standard.ReplaceText$StreamReplaceCallback.process(ReplaceText.java:860)
>         at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:3410)
>         at org.apache.nifi.controller.repository.BatchingSessionFactory$HighThroughputSession.write(BatchingSessionFactory.java:250)
>         at org.apache.nifi.processors.standard.ReplaceText$RegexReplace.replace(ReplaceText.java:659)
>         at org.apache.nifi.processors.standard.ReplaceText.onTrigger(ReplaceText.java:411)
>         at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>         at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1276)
>         at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:220)
>         at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:102)
>         at org.apache.nifi.engine.FlowEngine.lambda$wrap$1(FlowEngine.java:105)
>         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
>         at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
>         at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
>         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
>         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
>         at java.base/java.lang.Thread.run(Thread.java:1583)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)