markap14 commented on a change in pull request #4655:
URL: https://github.com/apache/nifi/pull/4655#discussion_r524528057
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java
##########
@@ -760,15 +782,26 @@ private void processTailFile(final ProcessContext
context, final ProcessSession
final FileChannel fileReader = reader;
final AtomicLong positionHolder = new AtomicLong(position);
+ final Boolean reReadOnNul =
context.getProperty(REREAD_ON_NUL).asBoolean();
+
+ AtomicReference<NulCharacterEncounteredException> abort = new
AtomicReference<>();
Review comment:
I think this approach is fine and not worth changing at this point, but
just for future reference: when Exceptions might be thrown from a callback, it
tends to be cleaner to use the `OutputStream write(FlowFile)` method of
`ProcessSession`. So something like:
```
try (final OutputStream rawOut = session.write(flowFile)) {
... interact with OutputStream here. Since there's no callback, any
Exception that gets thrown here will just propagate outside of the
try-with-resources ...
} catch (NulCharacterEncounteredException e) {
positionHolder.set(e.getRePos());
session.remove(flowFile);
throw e;
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]