Jairo Henao created NIFI-9175:
---------------------------------

             Summary: PutSQL - NullPointer when evaluating expressions in the 
SQL Statement
                 Key: NIFI-9175
                 URL: https://issues.apache.org/jira/browse/NIFI-9175
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Core Framework
    Affects Versions: 1.13.1
         Environment: Windows 10, jdk-11.0.10.9-hotspot
            Reporter: Jairo Henao
         Attachments: 2021-08-27_173654.png

PutSQL: If a Nifi Expression is configured for the 'SQL Statement' property 
that uses the function replaceAll where the replacement value is null, 
generates a NullPointer without details

Example:
{quote}SQL Statement = ${VARIABLE_NAME:replaceAll(regex, ${my_att_name})
{quote}
If '*my_att_name*' is null or does not exist, the flowfile is yielded and a 
NullPointer with no details is thrown.

 
{quote}java.lang.RuntimeException: Failed to execute due to 
java.lang.NullPointerException
 at org.apache.nifi.processor.util.pattern.Put.onTrigger(Put.java:155)
 at 
org.apache.nifi.processors.standard.PutSQL.lambda$onTrigger$19(PutSQL.java:635)
 at 
org.apache.nifi.processor.util.pattern.PartialFunctions.onTrigger(PartialFunctions.java:120)
 at 
org.apache.nifi.processor.util.pattern.RollbackOnFailure.onTrigger(RollbackOnFailure.java:184)
 at org.apache.nifi.processors.standard.PutSQL.onTrigger(PutSQL.java:635)
 at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1173)
 at 
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:214)
 at 
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
 at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
 at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
 at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
 at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
 at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: null
 at 
java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1015)
 at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:998)
 at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1182)
 at java.base/java.lang.String.replaceAll(String.java:2126)
 at 
org.apache.nifi.attribute.expression.language.evaluation.functions.ReplaceAllEvaluator.evaluate(ReplaceAllEvaluator.java:46)
 at org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:461)
 at 
org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:225)
 at 
org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:57)
 at 
org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:52)
 at 
org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:165)
 at 
org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:152)
 at 
org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:137)
 at org.apache.nifi.processors.standard.PutSQL.lambda$new$5(PutSQL.java:328)
 at org.apache.nifi.processors.standard.PutSQL.lambda$new$7(PutSQL.java:387)
 at 
org.apache.nifi.processor.util.pattern.PutGroup.putFlowFiles(PutGroup.java:91)
 at org.apache.nifi.processor.util.pattern.Put.onTrigger(Put.java:103)
{quote}
 

 

When an expression with multiple _*replaceAll*_ is defined, there is no way to 
identify which one failed.

My request is to add a short message, indicating the fragment of the expression 
that throws the exception. 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to