Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-970

ProtocolEncoderOutputImpl.flush() occur a IllegalArgumentException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.6, 2.0.7
    • Fix Version/s: 2.0.8
    • Component/s: Core
    • Labels:
      None
    • Environment:
      anywhere

      Description

      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

        Issue Links

          Activity

          Hide
          zengjie zengjie added a comment -

          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); }
          Show
          zengjie zengjie added a comment - 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); }
          Hide
          elecharny Emmanuel Lecharny added a comment -

          Fixed, at least...

          Show
          elecharny Emmanuel Lecharny added a comment - Fixed, at least...

            People

            • Assignee:
              Unassigned
              Reporter:
              zengjie zengjie
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development