nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-4340) RecordPathResult may throw NPE
Date Sun, 10 Sep 2017 13:56:00 GMT

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

ASF GitHub Bot commented on NIFI-4340:
--------------------------------------

Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2122#discussion_r137950192
  
    --- Diff: nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/WildcardIndexPath.java
---
    @@ -65,6 +65,7 @@
                     } else {
                         final Object[] array = (Object[]) value;
                         return IntStream.range(0, array.length)
    +                        .filter(index -> array[index] != null)
    --- End diff --
    
    Hey @markap14, thanks for the review. While I agree with your comment, it turns out (if
I looked correctly) that, currently, updating an array of simple elements is not possible.
If I set:
    ```
    /numbers[*]
    ````
    as the path to update with a value of 8, it won't update anything.
    
    I rebased against master and pushed another commit to fix the update action when updating
an array of simple (not records) elements, and also to address your comment. Let me know if
it looks like the right approach to you.


> RecordPathResult may throw NPE
> ------------------------------
>
>                 Key: NIFI-4340
>                 URL: https://issues.apache.org/jira/browse/NIFI-4340
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.3.0
>            Reporter: Pierre Villard
>            Assignee: Pierre Villard
>
> When using UpdateRecord and indicating a path existing in the schema but pointing to
a null field, it'll throw a NullPointerException.
> Basically, NPE is thrown at:
> {noformat}
> result.getSelectedFields().forEach(...)
> {noformat}
> or
> {noformat}
> recordPath.evaluate(record).getSelectedFields().iterator().hasNext()
> {noformat}
> Stack trace:
> {noformat}
> 2017-08-31 18:21:24,202 ERROR [Timer-Driven Process Thread-5] o.a.n.processors.standard.UpdateRecord
UpdateRecord[id=39158233-015e-1000-c81d-5cbd8f5cddf1] Failed to process StandardFlowFileRecord[uuid=f1807e4b-3374-4d9d-bfcf-b44ef7b6910b,claim=StandardContentClaim
[resourceClaim=StandardResourceClaim[id=1504194471839-1, container=default, section=1], offset=63430,
length=5291],offset=0,name=340191697112484,size=5291]: java.lang.NullPointerException
> java.lang.NullPointerException: null
> 	at org.apache.nifi.record.path.paths.ChildFieldPath.getChild(ChildFieldPath.java:50)
> 	at org.apache.nifi.record.path.paths.ChildFieldPath.lambda$evaluate$0(ChildFieldPath.java:67)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
> 	at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
> 	at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
> 	at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
> 	at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
> 	at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
> 	at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
> 	at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
> 	at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
> 	at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
> 	at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
> 	at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
> 	at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at org.apache.nifi.processors.standard.UpdateRecord.process(UpdateRecord.java:168)
> 	at org.apache.nifi.processors.standard.AbstractRecordProcessor$1.process(AbstractRecordProcessor.java:129)
> 	at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2785)
> 	at org.apache.nifi.processors.standard.AbstractRecordProcessor.onTrigger(AbstractRecordProcessor.java:118)
> 	at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
> 	at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
> 	at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
> 	at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
> 	at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message