You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by mattyb149 <gi...@git.apache.org> on 2016/11/03 16:40:55 UTC

[GitHub] nifi pull request #1088: NIFI-2841 Refactoring logic in SplitAvro RecordSpli...

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

    https://github.com/apache/nifi/pull/1088#discussion_r86388099
  
    --- Diff: nifi-nar-bundles/nifi-avro-bundle/nifi-avro-processors/src/main/java/org/apache/nifi/processors/avro/SplitAvro.java ---
    @@ -267,7 +267,8 @@ public void process(InputStream rawIn) throws IOException {
                             }
     
                             // while records are left, start a new split by spawning a FlowFile
    -                        while (reader.hasNext()) {
    +                        final AtomicReference<Boolean> hasNextHolder = new AtomicReference<Boolean>(reader.hasNext());
    --- End diff --
    
    If there are no records, then the call to reader.next() [will throw a NoSuchElementException](https://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/file/DataFileStream.html#next(D)). You could wrap the code in a try/catch, but then it's a little heavier, so the AtomicReference is probably fine?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---