You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/04 19:30:58 UTC

[jira] [Commented] (NIFI-3278) TextLineDemarcator fails when InputStream ends with '\r' and its length equals buffer length

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

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

Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1389#discussion_r94648686
  
    --- Diff: nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/TextLineDemarcator.java ---
    @@ -159,8 +159,11 @@ private int isEol(byte currentByte, int currentIndex) {
                     this.index = currentIndex + 1;
                     this.fill();
                 }
    -            currentByte = this.buffer[currentIndex + 1];
    -            crlfLength = currentByte == '\n' ? 2 : 1;
    +            crlfLength = 1;
    +            if (this.bufferLength != -1) {
    --- End diff --
    
    This should also ensure that currentIndex < this.buffer.length -1


> TextLineDemarcator fails when InputStream ends with '\r' and its length equals buffer length
> --------------------------------------------------------------------------------------------
>
>                 Key: NIFI-3278
>                 URL: https://issues.apache.org/jira/browse/NIFI-3278
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Oleg Zhurakousky
>            Assignee: Oleg Zhurakousky
>            Priority: Critical
>             Fix For: 1.2.0
>
>
> This is really an edge case, but there is a bug in _isEol()_ operation which attempts to read the next byte after call to _fill()_ even though that may be the end of the stream. And it only happens IF the current character is '\r' and the length of the InputStream is the length of the buffer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)