directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r380596 - in /directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec: ProtocolEncoderOutput.java support/SimpleProtocolEncoderOutput.java
Date Fri, 24 Feb 2006 06:05:43 GMT
Author: trustin
Date: Thu Feb 23 22:05:40 2006
New Revision: 380596

URL: http://svn.apache.org/viewcvs?rev=380596&view=rev
Log:
Fixed issue: DIRMINA-177 (ProtocolEncoderOutput.flush() writes an extra empty buffer.)
* Modified ProtocolEncoderOutput to return null if nothing is flushed.

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolEncoderOutput.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolEncoderOutput.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolEncoderOutput.java?rev=380596&r1=380595&r2=380596&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolEncoderOutput.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/ProtocolEncoderOutput.java
Thu Feb 23 22:05:40 2006
@@ -53,6 +53,8 @@
      * the session.  This operation is asynchronous; please wait for
      * the returned {@link WriteFuture} if you want to wait for
      * the buffers flushed.
+     * 
+     * @return <tt>null</tt> if there is nothing to flush at all.
      */
     WriteFuture flush();
 }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java?rev=380596&r1=380595&r2=380596&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java
Thu Feb 23 22:05:40 2006
@@ -76,7 +76,7 @@
         WriteFuture future = null;
         if( bufferQueue.isEmpty() )
         {
-            future = doFlush( ByteBuffer.allocate( 0 ).flip() ); // write zero bytes
+            return null;
         }
         else
         {
@@ -88,13 +88,12 @@
                     break;
                 }
                 
-                future = doFlush( buf );
+                // Flush only when the buffer has remaining.
+                if( buf.hasRemaining() )
+                {
+                    future = doFlush( buf );
+                }
             }
-        }
-        
-        if( future == null )
-        {
-            throw new IllegalStateException( "doFlush must return future." );
         }
         
         return future;



Mime
View raw message