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

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

Github user devriesb commented on the issue:

    https://github.com/apache/nifi/pull/2461
  
    Agreed on specifying a char set, but other than that I think it looks good!


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