commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bugs #12357] Java NIO: ReadableByteChannel.read() tries to


From: Robert Schuster
Subject: [commit-cp] [bugs #12357] Java NIO: ReadableByteChannel.read() tries to read to much data
Date: Thu, 17 Mar 2005 21:17:09 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.5) Gecko/20050107

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12357>

                 Summary: Java NIO: ReadableByteChannel.read() tries to read
to much data
                 Project: classpath
            Submitted by: rschuster
            Submitted on: Thu 03/17/2005 at 21:17
                Category: classpath
                Severity: 7 - Major
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

The specification says the read(ByteBuffer bb) method should not read more
than bb.remaining(). However at least for our SocketChannel implementation
this is not provided.

A testcase may be written this way

// A channel that is know to have data in it
ReadableByteChannel rbc = ...

// some ByteBuffer (may be direct or not)
ByteBuffer bb = ...

// fills it to the max
while(bb.hasRemaining()) {
    bb.put((byte) 12);
}

int read = -1;
boolean exceptionThrown = false;

try {
  read = rbc.read(bb);
} catch(Exception e) {
  exceptionThrown = true;
}

harness.check(read, 0);
harness.check(exceptionThrown, false);

Then we just need to create all kinds of ReadableByteChannel implmentations
and run this against this framework.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12357>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]