[ 
https://issues.apache.org/jira/browse/NIFI-15523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Handermann resolved NIFI-15523.
-------------------------------------
    Fix Version/s: 2.8.0
       Resolution: Fixed

> Provenance EventIterator.of doesn't return any events
> -----------------------------------------------------
>
>                 Key: NIFI-15523
>                 URL: https://issues.apache.org/jira/browse/NIFI-15523
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: David Young
>            Assignee: David Young
>            Priority: Minor
>             Fix For: 2.8.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Although it doesn't appear to be actually used anywhere, an EventIterator 
> that is created using the static `of` method will never actually return any 
> events.
> [Source|https://github.com/apache/nifi/blob/4f99d4a3786ef8f2472ccfe73a42dd5d316c76aa/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/EventIterator.java#L45-L57]:
> {code:java}
> static EventIterator of(final ProvenanceEventRecord... events) {
>     final Iterator<ProvenanceEventRecord> itr = 
> Arrays.asList(events).iterator();
>     return new EventIterator() {
>         @Override
>         public void close() throws IOException {
>         }
>         @Override
>         public Optional<ProvenanceEventRecord> nextEvent() {
>             return itr.hasNext() ? Optional.empty() : Optional.of(itr.next());
>         }
>     };
> }{code}
> The conditions in the `nextEvent` method need to be swapped:
> {code:java}
> return itr.hasNext() ? Optional.of(itr.next()) : Optional.empty();
> {code}
>  



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

Reply via email to