[ 
https://issues.apache.org/jira/browse/NIFI-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14371270#comment-14371270
 ] 

ASF GitHub Bot commented on NIFI-396:
-------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-nifi/pull/39


> 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)

Reply via email to