You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/05/08 03:03:25 UTC

svn commit: r654363 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java

Author: akarasulu
Date: Wed May  7 18:03:24 2008
New Revision: 654363

URL: http://svn.apache.org/viewvc?rev=654363&view=rev
Log:
fixing couple bugs in encoder to implement ldap client:

 o the blockingEncode method did not attach the output stream to the channel
   and caused NPE to be thrown
 o the buffer on decode callbacks was not being flipped before writing it to 
   the channel causing messages to be lost


Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java?rev=654363&r1=654362&r2=654363&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java Wed May  7 18:03:24 2008
@@ -68,7 +68,7 @@
      * 
      * @param provider The associated Provider
      */
-    public TwixEncoder(Provider provider)
+    public TwixEncoder( Provider provider )
     {
         this.provider = provider;
         encodeCallback = new OutputCallback();
@@ -92,6 +92,7 @@
                 log.debug( "Encoding this LdapMessage : " + obj );
             }
 
+            ( ( OutputCallback ) encodeCallback ).attach( out );
             encodeCallback.encodeOccurred( null, ( ( LdapMessage ) obj ).encode( null ) );
         }
         catch ( EncoderException e )
@@ -255,6 +256,7 @@
         {
             try
             {
+                ( ( ByteBuffer ) encoded ).flip();
                 channel.write( ( ByteBuffer ) encoded );
             }
             catch ( IOException e )