(ch) Writer created by Channels::newWriter may lose data

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 22
    • Affects Version/s: 8, 11, 17, 21
    • Component/s: core-libs
    • b21
    • Verified

      Spotted during code review; no known impact.

      StreamEncoder.writeBytes assumes (and asserts) that all bytes will be written to the target channel in a single invocation of write. If a channel only consumes a part of the provided ByteBuffer, any excess is lost.

      The attached test creates a writer on a channel that only consumes one byte at a time from the passed ByteBuffer. It should eventually consume all characters. Instead it either loses characters, or asserts if system assertions are enabled.

            Assignee:
            Brian Burkhalter
            Reporter:
            Daniel Jelinski
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: