You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2012/06/07 22:42:24 UTC

[jira] [Created] (IO-335) Tailer#readLines - incorrect CR handling

Sebb created IO-335:
-----------------------

             Summary: Tailer#readLines - incorrect CR handling
                 Key: IO-335
                 URL: https://issues.apache.org/jira/browse/IO-335
             Project: Commons IO
          Issue Type: Bug
            Reporter: Sebb


The readLines method checks for CR. If found, it is not stored immediately, but a flag is set.

If the next char is an LF, the buffer is passed to the listener without the CR.
As soon as the next non-LF (and non-CR) character is received, the saved CR is written to the buffer.

The net result is that CR before LF migrates to the start of the next non-empty line, and repeated CRs are collapsed. This is clearly wrong.

The original code (before IO-274) used RandomAccessFile#readLine() which returns on CR, LF or CRLF.

It looks as though the intention was to retain this behaviour whilst not blocking.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (IO-335) Tailer#readLines - incorrect CR handling

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved IO-335.
---------------------

       Resolution: Fixed
    Fix Version/s: 2.4
    
> Tailer#readLines - incorrect CR handling
> ----------------------------------------
>
>                 Key: IO-335
>                 URL: https://issues.apache.org/jira/browse/IO-335
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Sebb
>             Fix For: 2.4
>
>
> The readLines method checks for CR. If found, it is not stored immediately, but a flag is set.
> If the next char is an LF, the buffer is passed to the listener without the CR.
> As soon as the next non-LF (and non-CR) character is received, the saved CR is written to the buffer.
> The net result is that CR before LF migrates to the start of the next non-empty line, and repeated CRs are collapsed. This is clearly wrong.
> The original code (before IO-274) used RandomAccessFile#readLine() which returns on CR, LF or CRLF.
> It looks as though the intention was to retain this behaviour whilst not blocking.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira