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

(ch) ReadableByteChannel returned by Channels.newChannel(InputStream) throws ReadOnlyBufferException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b20
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Such a ReadableByteChannel should throw an IllegalArgumentException. This may be demonstrated by modifying java/nio/channels/Channels/Basic.java as:

      @@ -296,6 +296,12 @@ public class Basic {
               byte data[] = new byte[messageSize+1];
               ByteBuffer bb = ByteBuffer.wrap(data);
       
      + try {
      + rbc.read(bb.asReadOnlyBuffer());
      + } catch (IllegalArgumentException expected) {
      + // ignore it
      + }
      +
               int bytesRead = 0;
               int totalRead = 0;
               while (bytesRead != -1) {

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              bpb Brian Burkhalter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: