commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (NET-497) ToNetASCIIInputStream skips LF at the end of the stream
Date Mon, 28 Jan 2013 23:31:13 GMT

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

Sebb updated NET-497:
---------------------

    Description: 
I have the following failing test case for ToNetASCIIInputStream:

{noformat}
    public void testToNetASCIIInputStream() throws Exception
    {
        final Charset ASCII = Charset.forName("ASCII");
        byte[] data = "Hello\nWorld\n".getBytes(ASCII);
        InputStream source = new ByteArrayInputStream(data);
        ToNetASCIIInputStream toNetASCII = new ToNetASCIIInputStream(source);
        byte[] output = new byte[512];
        int length = toNetASCII.read(output);
        byte[] result = new byte[length];
        System.arraycopy(output, 0, result, 0, length);
        assertEquals('\r', result[length-2]);
        assertEquals('\n', result[length-1]);
    }
{noformat}


  was:
I have the following failing test case for ToNetASCIIInputStream:

    public void testToNetASCIIInputStream() throws Exception
    {
        final Charset ASCII = Charset.forName("ASCII");
        byte[] data = "Hello\nWorld\n".getBytes(ASCII);
        InputStream source = new ByteArrayInputStream(data);
        ToNetASCIIInputStream toNetASCII = new ToNetASCIIInputStream(source);
        byte[] output = new byte[512];
        int length = toNetASCII.read(output);
        byte[] result = new byte[length];
        System.arraycopy(output, 0, result, 0, length);
        assertEquals('\r', result[length-2]);
        assertEquals('\n', result[length-1]);
    }


    
> ToNetASCIIInputStream skips LF at the end of the stream
> -------------------------------------------------------
>
>                 Key: NET-497
>                 URL: https://issues.apache.org/jira/browse/NET-497
>             Project: Commons Net
>          Issue Type: Bug
>          Components: Telnet, TFTP
>    Affects Versions: 3.1
>            Reporter: Mirko Raner
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I have the following failing test case for ToNetASCIIInputStream:
> {noformat}
>     public void testToNetASCIIInputStream() throws Exception
>     {
>         final Charset ASCII = Charset.forName("ASCII");
>         byte[] data = "Hello\nWorld\n".getBytes(ASCII);
>         InputStream source = new ByteArrayInputStream(data);
>         ToNetASCIIInputStream toNetASCII = new ToNetASCIIInputStream(source);
>         byte[] output = new byte[512];
>         int length = toNetASCII.read(output);
>         byte[] result = new byte[length];
>         System.arraycopy(output, 0, result, 0, length);
>         assertEquals('\r', result[length-2]);
>         assertEquals('\n', result[length-1]);
>     }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message