Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.24.0, 2.0.0-M2
-
None
-
None
-
Docker, RedHat 8
Description
My use case is I want to create a field called "original" which is the escaped string of my whole record. This will preserve the original contents of the message before I start transforming it.
My expectation is that I should be able to use an UpdateRecord processor to create the field using RecordPath language.
What actually happens is that when I use
escapeJson(/)
as the function the result is that the processor throws a Null Pointer Exception (NPE).
Detail:
For any input flow file containing JSON records, define an UpdateRecord processor with these settings.
- Replacement Value Strategy = Record Path Value
- /original = escapeJson
When the flow file is presented to the processor, the processor generates an NPE.
For example, I present this record.
[{"hello":"world","record":{"key":"one","value":"hello","subrecord":{"key":"two","value":"bob"}},"array":[0,1,2]}]
If the escapeJson function is offered an existing field to escape then it works as expected. Stack trace as follows.
2024-01-31 12:17:15 2024-01-31 12:17:14,741 ERROR [Timer-Driven Process Thread-8] o.a.n.processors.standard.UpdateRecord UpdateRecord[id=5f6b498d-018d-1000-0000-0000323c6b89] Failed to process StandardFlowFileRecord[uuid=2d4a3eab-e752-4117-93d3-3e5515b6f3f8,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1706703050563-1, container=default, section=1], offset=114, length=114],offset=0,name=2d4a3eab-e752-4117-93d3-3e5515b6f3f8,size=114]; will route to failure 2024-01-31 12:17:15 org.apache.nifi.record.path.exception.RecordPathException: java.lang.NullPointerException 2024-01-31 12:17:15 at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:105) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$2(LocalLoadingCache.java:145) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2406) 2024-01-31 12:17:15 at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2404) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2387) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108) 2024-01-31 12:17:15 at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:56) 2024-01-31 12:17:15 at org.apache.nifi.record.path.util.RecordPathCache.getCompiled(RecordPathCache.java:34) 2024-01-31 12:17:15 at org.apache.nifi.processors.standard.UpdateRecord.process(UpdateRecord.java:166) 2024-01-31 12:17:15 at org.apache.nifi.processors.standard.AbstractRecordProcessor$1.process(AbstractRecordProcessor.java:147) 2024-01-31 12:17:15 at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:3432) 2024-01-31 12:17:15 at org.apache.nifi.processors.standard.AbstractRecordProcessor.onTrigger(AbstractRecordProcessor.java:122) 2024-01-31 12:17:15 at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) 2024-01-31 12:17:15 at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1361) 2024-01-31 12:17:15 at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:247) 2024-01-31 12:17:15 at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:102) 2024-01-31 12:17:15 at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) 2024-01-31 12:17:15 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 2024-01-31 12:17:15 at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) 2024-01-31 12:17:15 at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) 2024-01-31 12:17:15 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 2024-01-31 12:17:15 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 2024-01-31 12:17:15 at java.base/java.lang.Thread.run(Unknown Source) 2024-01-31 12:17:15 Caused by: java.lang.NullPointerException: null 2024-01-31 12:17:15 at org.apache.nifi.record.path.paths.RecordPathCompiler.buildPath(RecordPathCompiler.java:131) 2024-01-31 12:17:15 at org.apache.nifi.record.path.paths.RecordPathCompiler.getArgPaths(RecordPathCompiler.java:511) 2024-01-31 12:17:15 at org.apache.nifi.record.path.paths.RecordPathCompiler.buildPath(RecordPathCompiler.java:328) 2024-01-31 12:17:15 at org.apache.nifi.record.path.paths.RecordPathCompiler.compile(RecordPathCompiler.java:100) 2024-01-31 12:17:15 at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:101) 2024-01-31 12:17:15 ... 23 common frames omitted
Attachments
Attachments
Issue Links
- links to