[ 
https://issues.apache.org/jira/browse/NIFI-4856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevin Doran updated NIFI-4856:
------------------------------
       Resolution: Fixed
    Fix Version/s: 1.6.0
           Status: Resolved  (was: Patch Available)

> ByteCountingInputStream should override available()
> ---------------------------------------------------
>
>                 Key: NIFI-4856
>                 URL: https://issues.apache.org/jira/browse/NIFI-4856
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.5.0
>            Reporter: Brandon DeVries
>            Assignee: Andy LoPresto
>            Priority: Major
>             Fix For: 1.6.0
>
>
> ByteCountingInputStream [1] does not override the InputStream.available() 
> method as indicated in the InputStream javadocs [2].  In 0.x[3] there was 
> another implementation of ByteCountingInputStream  that correctly overrode 
> available().  However, this was replaced with the incorrect version in 1.x. 
>  
> This causes any processor that attempts to use the available() method of the 
> InputStream returned from ProcessSession.read() to erroneously believe it has 
> reached the end of the stream, as this method is supposed to return "an 
> estimate of the number of bytes that can be read (or skipped over) from this 
> input stream without blocking *or {{0}} when it reaches the end* of the input 
> stream."
>  
> The following method needs to be added:
> {code:java}
> @Override
> public int available() throws IOException {
>      return in.available();
> }{code}
>  
> [1] 
> [https://github.com/apache/nifi/blob/rel/nifi-1.5.0/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingInputStream.java]
> [2] [https://docs.oracle.com/javase/8/docs/api/index.html]
> [3] 
> [https://github.com/apache/nifi/blob/0.x/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/io/ByteCountingInputStream.java]
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to