mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zengjie (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRMINA-970) ProtocolEncoderOutputImpl.flush() occur a IllegalArgumentException
Date Mon, 25 Nov 2013 07:13:36 GMT

    [ 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)

Mime
View raw message