Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164993

(ch) ReadableByteChannel should note a possible IllegalArgumentException

    Details

    • Subcomponent:
    • Resolved In Build:
      b25
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REQUEST :
      In the interface java.nio.channels.ReadableByteChannel, the read() method takes a ByteBuffer as an argument and writes the result of reading from the channel into the ByteBuffer. However, none of the error conditions noted in the documentation for this function consider the possibility that the ByteBuffer passed as an argument could be read-only, which would throw a ReadOnlyBufferException.

      JUSTIFICATION :
      Documenting this possible error condition would make it clearer that a read-only ByteBuffer should not be passed to the function and could perhaps prompt programmers to check or be certain that ByteBuffers they pass for reading are not read-only.

      Perhaps some wording in the comment alluding to the fact that the argument should not be a read-only ByteBuffer would probably be sufficient to serve this purpose.


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: