[
https://issues.apache.org/jira/browse/NIFI-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14371267#comment-14371267
]
ASF subversion and git services commented on NIFI-396:
------------------------------------------------------
Commit e2760f8c980583d285137134e05c435c930fb4d2 in incubator-nifi's branch
refs/heads/develop from [~rowolabi]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-nifi.git;h=e2760f8 ]
NIFI-396 added a DisableOnCloseInputStream class; modified
StandardProcessSession to prevent access of the Input/OutputStreams after
callbacks have been executed; updated tests
> 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
>
> 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)