Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-497

ToNetASCIIInputStream skips LF at the end of the stream

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Telnet, TFTP
    • Labels:
      None

      Description

      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]);
          }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mirko@raner.ws Mirko Raner
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified