[
https://issues.apache.org/jira/browse/NIFI-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14371272#comment-14371272
]
Mark Payne commented on NIFI-396:
---------------------------------
Bobby,
Thanks for picking this up! Did a code review. Tested locally. Works great.
Excellent unit test coverage. Pushed to develop, so this will be in the 0.1.0
release.
Thanks again!
-Mark
> StandardProcessSession allows InputStream to be accessed after returning from
> callback
> --------------------------------------------------------------------------------------
>
> Key: NIFI-396
> URL: https://issues.apache.org/jira/browse/NIFI-396
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Mark Payne
> Labels: beginner
> Fix For: 0.1.0
>
>
> When StandardProcessSession.read(FlowFile, InputStreamCallback) or
> StandardProcessSession.write(FlowFile, StreamCallback) is called, the
> InputStream that is provided to the callback can be accessed after returning
> from the callback. For example:
> final ObjectHolder<InputStream> inputStreamHolder = new ObjectHolder<>(null);
> session.read(flowFile, new InputStreamCallback() {
> @Override
> public void process(InputStream in) throws IOException {
> inputStreamHolder.set(in);
> }
> });
> // read from inputStreamHolder.get()
> At this point, attempting to read from inputStreamHolder.get() should throw
> an IOException but does not.
> This is because the stream that is returned by StandardProcessSession is
> wrapping a NonCloseableInputStream. This NonCloseableInputStream should
> instead be a DisableOnCloseInputStream (which does not exist but should be
> written in a very similar fashion to DisableOnCloseOutputStream).
> The JavaDocs for ProcessSession should also be updated to indicate that the
> streams provided will be managed by the framework and will not be accessible
> once the callback returns.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)