[xSocket-develop] Fwd: i got an error with xSocket V1_2_1
Status: Inactive
Brought to you by:
grro
|
From: PyungMoon O. <qud...@gm...> - 2008-01-18 08:40:35
|
i found it..
in the below source code..remainingToExtract value was minus value..
public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer> inOutBuffer,
int length) throws IOException, BufferUnderflowException {
LinkedList<ByteBuffer> result = new LinkedList<ByteBuffer>();
int remainingToExtract = length;
ByteBuffer buffer = null;
do {
// get the next buffer
buffer = inOutBuffer.remove();
if (buffer == null) {
throw new BufferUnderflowException();
}
// can complete buffer be taken?
int bufLength = buffer.limit() - buffer.position();
if (remainingToExtract >= bufLength) {
// write taken into out channel
result.addLast(buffer);
remainingToExtract -= bufLength;
// .. no
} else {
int savedLimit = buffer.limit();
// extract the takenable
buffer.limit(buffer.position() + remainingToExtract);
ByteBuffer leftPart = buffer.slice();
result.addLast(leftPart);
buffer.position(buffer.limit());
buffer.limit(savedLimit);
ByteBuffer rightPart = buffer.slice();
inOutBuffer.addFirst(rightPart);
break;
}
} while (remainingToExtract > 0);
return result;
}
---------- Forwarded message ----------
From: PyungMoon Oh <qud...@gm...>
Date: 2008. 1. 18 17:31
Subject: i got an error with xSocket V1_2_1
To: xso...@li...
i got an error message like this..
but i think it can not be happen if there is no another thread which is
accessing the buffer..
as i know "public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer>
inOutBuffer, int length) throws IOException, BufferUnderflowException {"
method check limit before call " java.nio.Buffer.limit" method..
am i right??
but i can not find it..
can someone tell me why it's happening?? and which threads are accessing the
buffer?
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:249)
at org.xsocket.stream.ByteBufferParser.extract(ByteBufferParser.java
:167)
at org.xsocket.stream.Connection.extractBytesByLength(
Connection.java:915)
at org.xsocket.stream.NonBlockingConnection.readByteBufferByLength(
NonBlockingConnection.java:574)
at org.xsocket.stream.NonBlockingConnection.readBytesByLength(
NonBlockingConnection.java:609)
thanks//
|