You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "zengjie (JIRA)" <ji...@apache.org> on 2013/11/25 08:13:36 UTC
[jira] [Commented] (DIRMINA-970) ProtocolEncoderOutputImpl.flush()
occur a IllegalArgumentException
[ https://issues.apache.org/jira/browse/DIRMINA-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13831218#comment-13831218 ]
zengjie commented on DIRMINA-970:
---------------------------------
add constructors like this:
public DefaultWriteRequest(Object message, WriteFuture future, SocketAddress destination,boolean allowNullMsg) {
if (message == null && !allowNullMsg) {
throw new IllegalArgumentException("message");
}
if (future == null) {
future = UNUSED_FUTURE;
}
this.message = message;
this.future = future;
this.destination = destination;
}
public DefaultWriteRequest(Object message,boolean allowNullMsg) {
this(message, null, null,allowNullMsg);
}
> ProtocolEncoderOutputImpl.flush() occur a IllegalArgumentException
> ------------------------------------------------------------------
>
> Key: DIRMINA-970
> URL: https://issues.apache.org/jira/browse/DIRMINA-970
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.6, 2.0.7
> Environment: anywhere
> Reporter: zengjie
> Priority: Critical
> Fix For: 2.0.6
>
>
> public WriteFuture flush() {
> Queue<Object> bufferQueue = getMessageQueue();
> WriteFuture future = null;
> while (!bufferQueue.isEmpty()) {
> Object encodedMessage = bufferQueue.poll();
> if (encodedMessage == null) {
> break;
> }
> // Flush only when the buffer has remaining.
> if (!(encodedMessage instanceof IoBuffer) || ((IoBuffer) encodedMessage).hasRemaining()) {
> future = new DefaultWriteFuture(session);
> nextFilter.filterWrite(session, new EncodedWriteRequest(encodedMessage, future, destination));
> }
> }
> if (future == null) {
> // Creates an empty writeRequest containing the destination
> WriteRequest writeRequest = new DefaultWriteRequest(null, null, destination);
> future = DefaultWriteFuture.newNotWrittenFuture(session, new NothingWrittenException(writeRequest));
> }
> return future;
> }
> if there are nothing in message queue ,this method try to return a future to represent a NotWritten operation with DefaultWriteRequest, but a IllegalArgumentException was throw while constructing a DefaultWriteRequest with a null message
--
This message was sent by Atlassian JIRA
(v6.1#6144)