Uploaded image for project: 'JBoss Remoting (3+)'
  1. JBoss Remoting (3+)
  2. REM3-14

Problems in ReaderInputStream

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.1.0.Beta3
    • 3.1.0.Beta2
    • None

      There are a couple of little problems in org.jboss.remoting3.stream.ReaderInputStream:

      1. When you enter read(), you want byteBuffer to be in "read" mode, so byteBuffer.flip() should be added to the constructor.

      2. When you enter flip(), you want charBuffer to be in "read" mode, so charBuffer.flip() should be added to the constructor.

      3. In fill()

      try {
      final int cnt = reader.read(charBuffer);
      if (cnt == -1)

      { return false; }

      doesn't tmake sense. It could be that you've transferred some bytes to byteBuffer and now reader is empty. When changed to

      try {
      final int cnt = reader.read(charBuffer);
      if (cnt == -1)

      { // return false; return byteBuffer.position() > 0; }

      the code works.

            Unassigned Unassigned
            rsigal@redhat.com Ronald Sigal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: