directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1063824 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec: LdapDecoder.java LdapMessageContainer.java LdapMessageGrammar.java
Date Wed, 26 Jan 2011 18:49:24 GMT
Author: elecharny
Date: Wed Jan 26 18:49:23 2011
New Revision: 1063824

URL: http://svn.apache.org/viewvc?rev=1063824&view=rev
Log:
Fixed a bug in the way we stored the message in the LdapMessageContainer

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java?rev=1063824&r1=1063823&r2=1063824&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
Wed Jan 26 18:49:23 2011
@@ -24,12 +24,13 @@ import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.security.ProviderException;
 
+import org.apache.directory.shared.asn1.DecoderCallback;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
-import org.apache.directory.shared.asn1.DecoderCallback;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.exception.ResponseCarryingMessageException;
+import org.apache.directory.shared.ldap.model.message.Message;
 import org.apache.directory.shared.util.Strings;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.session.IoSession;
@@ -249,8 +250,10 @@ public class LdapDecoder implements Prot
                     {
                         LOG.debug( "Decoded LdapMessage : " + messageContainer.getMessage()
);
                     }
-
-                    out.write( messageContainer.getMessage() );
+                    
+                    Message message = messageContainer.getMessage();
+                    
+                    out.write( message );
 
                     messageContainer.clean();
                 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=1063824&r1=1063823&r2=1063824&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
Wed Jan 26 18:49:23 2011
@@ -63,7 +63,7 @@ public class LdapMessageContainer extend
     private Message message;
 
     /** The Message decorator to store various temporary values */
-    private MessageDecorator decorator;
+    private MessageDecorator messageDecorator;
 
     /** checks if attribute is binary */
     private final BinaryAttributeDetector binaryAttributeDetector;
@@ -274,7 +274,7 @@ public class LdapMessageContainer extend
      */
     public SearchRequest getSearchRequest()
     {
-        return (SearchRequest)(( SearchRequestDecorator ) message).getMessage();
+        return (SearchRequest)message;
     }
 
 
@@ -283,7 +283,7 @@ public class LdapMessageContainer extend
      */
     public SearchRequestDecorator getSearchRequestDecorator()
     {
-        return ( SearchRequestDecorator ) message;
+        return ( SearchRequestDecorator ) messageDecorator;
     }
 
 
@@ -335,14 +335,21 @@ public class LdapMessageContainer extend
     }
 
 
-    public MessageDecorator getMessageDecorator()
+    /**
+     * Set a Message Object decorator into the container. It will be completed by the
+     * ldapDecoder.
+     * 
+     * @param message The message to set.
+     */
+    public void setMessageDecorator( MessageDecorator messageDecorator )
     {
-        if ( decorator == null )
-        {
-            decorator = MessageDecorator.getDecorator( message );
-        }
+        this.messageDecorator = messageDecorator;
+    }
+
 
-        return decorator;
+    public MessageDecorator getMessageDecorator()
+    {
+        return messageDecorator;
     }
 
 
@@ -354,6 +361,7 @@ public class LdapMessageContainer extend
         super.clean();
 
         message = null;
+        messageDecorator = null;
         messageId = 0;
         currentControl = null;
         decodeBytes = 0;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=1063824&r1=1063823&r2=1063824&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Wed Jan 26 18:49:23 2011
@@ -75,7 +75,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
-import org.apache.directory.shared.ldap.model.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.filter.SearchScope;
@@ -120,6 +119,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.message.ResultResponse;
 import org.apache.directory.shared.ldap.model.message.SearchRequest;
+import org.apache.directory.shared.ldap.model.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.model.message.SearchResultDone;
 import org.apache.directory.shared.ldap.model.message.SearchResultDoneImpl;
 import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
@@ -3605,7 +3605,8 @@ public final class LdapMessageGrammar ex
                     SearchRequestDecorator searchRequestDecorator = new SearchRequestDecorator(
searchRequest );
 
                     searchRequestDecorator.setTlvId( tlv.getId());
-                    ldapMessageContainer.setMessage( searchRequestDecorator );
+                    ldapMessageContainer.setMessage( searchRequest );
+                    ldapMessageContainer.setMessageDecorator( searchRequestDecorator );
 
                     LOG.debug( "Search Request" );
                 }



Mime
View raw message