You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/06/21 22:37:56 UTC

svn commit: r191721 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/

Author: elecharny
Date: Tue Jun 21 13:37:54 2005
New Revision: 191721

URL: http://svn.apache.org/viewcvs?rev=191721&view=rev
Log:
Deleted the useless LENGTH states

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/CompareResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/DelResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchResultDoneGrammar.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java Tue Jun 21 13:37:54 2005
@@ -32,6 +32,7 @@
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.SaslCredentials;
 import org.apache.asn1.ldap.pojo.SimpleAuthentication;
+import org.apache.asn1.primitives.OctetString;
 
 import org.apache.log4j.Logger;
 
@@ -91,10 +92,13 @@
         // LdapMessage ::= ... BindRequest ...
         // BindRequest ::= [APPLICATION 0] SEQUENCE { ... (Length)
         super.transitions[LdapStatesEnum.BIND_REQUEST_TAG][0x60]    = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_TAG, LdapStatesEnum.BIND_REQUEST_LENGTH, null );
+                LdapStatesEnum.BIND_REQUEST_TAG, LdapStatesEnum.BIND_REQUEST_VALUE, null );
 
-        super.transitions[LdapStatesEnum.BIND_REQUEST_LENGTH][0x60] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_LENGTH, LdapStatesEnum.BIND_REQUEST_VALUE,
+        // LdapMessage ::= ... BindRequest ...
+        // BindRequest ::= [APPLICATION 0] SEQUENCE { ... (Value)
+        // Nothing to do, the Value is empty, this is a constructed TLV. We now can swith to the BindRequest Grammar
+        super.transitions[LdapStatesEnum.BIND_REQUEST_VALUE][0x60] = new GrammarTransition(
+                LdapStatesEnum.BIND_REQUEST_VALUE, LdapStatesEnum.BIND_REQUEST_VERSION_TAG, 
                 new GrammarAction( "Init BindRequest" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -105,52 +109,15 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessage, ldapMessageContainer.getCurrentTLV() );
-
                         // Now, we can allocate the BindRequest Object
-                        BindRequest bindRequest = new BindRequest();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-
-                        bindRequest.setExpectedLength( expectedLength );
-                        bindRequest.setCurrentLength( 0 );
-                        bindRequest.setParent( ldapMessage );
-
-                        // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( bindRequest );
+                        ldapMessage.setProtocolOP( new BindRequest() );
                     }
                 } );
 
-        // LdapMessage ::= ... BindRequest ...
-        // BindRequest ::= [APPLICATION 0] SEQUENCE { ... (Value)
-        // Nothing to do, the Value is empty, this is a constructed TLV. We now can swith to the BindRequest Grammar
-        super.transitions[LdapStatesEnum.BIND_REQUEST_VALUE][0x60] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_VALUE, LdapStatesEnum.BIND_REQUEST_VERSION_TAG, null );
-
         // BindRequest ::= ... version INTEGER (1 .. 127 ), ... (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.BIND_REQUEST_VERSION_TAG][0x02] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_VERSION_TAG, LdapStatesEnum.BIND_REQUEST_VERSION_LENGTH, null );
-
-        // BindRequest ::= ... version INTEGER (1 .. 127 ), ... (Length)
-        // Checks the length
-        super.transitions[LdapStatesEnum.BIND_REQUEST_VERSION_LENGTH][0x02] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_VERSION_LENGTH, LdapStatesEnum.BIND_REQUEST_VERSION_VALUE,
-                new GrammarAction( "Store version" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-
-                        checkLength( ldapMessageContainer.getLdapMessage().getProtocolOp(),
-                            ldapMessageContainer.getCurrentTLV() );
-                        return;
-                    }
-                } );
+                LdapStatesEnum.BIND_REQUEST_VERSION_TAG, LdapStatesEnum.BIND_REQUEST_VERSION_VALUE, null );
 
         // BindRequest ::= ... version INTEGER (1 .. 127 ), ... (value)
         // Checks that the Version is in [1, 127]
@@ -183,37 +150,7 @@
         // BindRequest ::= ... name LDAPDN, ... (Tag)
         // Nothing to do. The tag is supposed to be 0x04
         super.transitions[LdapStatesEnum.BIND_REQUEST_NAME_TAG][0x04] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_NAME_TAG, LdapStatesEnum.BIND_REQUEST_NAME_LENGTH, null );
-
-        // BindRequest ::= ... name LDAPDN, ... (Length)
-        // We just check the length.
-        super.transitions[LdapStatesEnum.BIND_REQUEST_NAME_LENGTH][0x04] = new GrammarTransition(
-                LdapStatesEnum.BIND_REQUEST_NAME_LENGTH, LdapStatesEnum.BIND_REQUEST_NAME_VALUE,
-                new GrammarAction( "Check Bind Name Length" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-                        BindRequest bindRequestMessage = 
-                        ldapMessageContainer.getLdapMessage().getBindRequest();
-                        
-                        TLV                  tlv                  =
-                            ldapMessageContainer.getCurrentTLV();
-
-
-                        checkLength( bindRequestMessage, tlv );
-                        
-                        // We have to handle the special case of a 0 length name
-                        if (tlv.getLength().getLength() == 0)
-                        {
-                            bindRequestMessage.setName( (LdapDN)LdapDN.EMPTY_STRING );
-                        }
-                        
-                        return;
-                    }
-                } );
+                LdapStatesEnum.BIND_REQUEST_NAME_TAG, LdapStatesEnum.BIND_REQUEST_NAME_VALUE, null );
 
         // BindRequest ::= ... name LDAPDN, ... (Value)
         // We have to store the name
@@ -233,8 +170,16 @@
                         // Get the Value and store it in the BindRequest
                         TLV             tlv                = ldapMessageContainer.getCurrentTLV();
 
-                        LdapDN name = new LdapDN(tlv.getValue().getData());
-                        bindRequestMessage.setName( name );
+                        // We have to handle the special case of a 0 length name
+                        if (tlv.getLength().getLength() == 0)
+                        {
+                            bindRequestMessage.setName( LdapDN.EMPTY_STRING );
+                        }
+                        else
+                        {
+                            bindRequestMessage.setName( new LdapDN( tlv.getValue().getData() ) );
+                        }
+                        
                         return;
                     }
                 } );
@@ -246,30 +191,29 @@
         // If it's 0x80, it is a SimpleAuthentication.
         //--------------------------------------------------------------------------------------------
         // Nothing to do.
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CHOICE_TAG][( 0x80 & 0x00FF )] =
+        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CHOICE_TAG][0x80] =
             new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CHOICE_TAG,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_LENGTH, null );
+                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE, null );
 
         // AuthenticationChoice ::= CHOICE {
-        //        simple         [0] OCTET STRING, (Length)
-        // We just have to check the length, and to allocate an authentication Object
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_LENGTH][( 0x80 & 0x00FF )] =
-            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_LENGTH,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE,
-                new GrammarAction( "Check simple authentication length" )
+        //        simple         [0] OCTET STRING, (Value)
+        // We have to create an Authentication Object to store the credentials.
+        // The nextState is GRAMMAR_END
+        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE][( 0x80 & 0x00FF )] =
+            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE,
+                LdapStatesEnum.GRAMMAR_END,
+                new GrammarAction( "Store Bind Simple Authentication value" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
 
                         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
                             container;
+                        
                         BindRequest bindRequestMessage = 
                         ldapMessageContainer.getLdapMessage().getBindRequest();
+                        TLV           tlv    = ldapMessageContainer.getCurrentTLV();
                         
-                        TLV             tlv                = ldapMessageContainer.getCurrentTLV();
-
-                        checkLength( bindRequestMessage, tlv );
-
                         // Allocate the Authentication Object
                         SimpleAuthentication authentication = null;
                         
@@ -284,36 +228,10 @@
                         {
                             authentication.setSimple( new byte[]{} );
                         }
-                        
-                        return;
-                    }
-                } );
-
-        // AuthenticationChoice ::= CHOICE {
-        //        simple         [0] OCTET STRING, (Value)
-        // We have to create an Authentication Object to store the credentials.
-        // The nextState is GRAMMAR_END
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE][( 0x80 & 0x00FF )] =
-            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE,
-                LdapStatesEnum.GRAMMAR_END,
-                new GrammarAction( "Store Bind Simple Authentication value" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-                        
-                        BindRequest bindRequestMessage = 
-                        ldapMessageContainer.getLdapMessage().getBindRequest();
-                        
-                        SimpleAuthentication simpleAuthentication = bindRequestMessage.getSimpleAuthentication();
-
-                        TLV           tlv    = ldapMessageContainer.getCurrentTLV();
-
-                        // Get the simple value
-                        // Store the simple in the authentication
-                        simpleAuthentication.setSimple( tlv.getValue().getData() );
+                        else
+                        {
+                            authentication.setSimple( tlv.getValue().getData() );
+                        }
                     }
                 } );
 
@@ -332,36 +250,31 @@
         // Nothing to do. In fact, 0x83 is the mechanism tag. 
         super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CHOICE_TAG][( 0x83 & 0x00FF )] =
             new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CHOICE_TAG,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_LENGTH, null );
+                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE, null );
 
         // AuthenticationChoice ::= CHOICE {
         //        sasl         [3] saslCredentials }
         //
         // SaslCredentials ::= SEQUENCE {
-        //        mechanism     LDAPSTRING,  (Length)
+        //        mechanism     LDAPSTRING,  (Value)
         //		  ...
-        // We just have to check the length.
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_LENGTH][( 0x83 & 0x00FF )] =
-            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_LENGTH,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE,
-                new GrammarAction( "Check sasl authentication mechanism length" )
+        // We have to store the mechanism.
+        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE][( 0x83 & 0x00FF )] =
+            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE,
+                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG,
+                new GrammarAction( "Create Bind sasl Authentication Object" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
 
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+                        LdapMessageContainer   ldapMessageContainer = ( LdapMessageContainer )
                             container;
-                        BindRequest bindRequestMessage = 
-                        ldapMessageContainer.getLdapMessage().getBindRequest();
-
-                        TLV           tlv    = ldapMessageContainer.getCurrentTLV();
+                        BindRequest        bindRequestMessage = 
+                            ldapMessageContainer.getLdapMessage().getBindRequest();
+                        TLV tlv = ldapMessageContainer.getCurrentTLV();
                         
-                        checkLength( bindRequestMessage, tlv );
-
                         // Create the SaslCredentials Object
-                        SaslCredentials authentication = null;
-
-                        authentication = new SaslCredentials();
+                        SaslCredentials authentication = new SaslCredentials();
 
                         authentication.setParent( bindRequestMessage );
 
@@ -372,43 +285,15 @@
                         {
                             authentication.setMechanism( LdapString.EMPTY_STRING );
                         }
+                        else
+                        {
+                            authentication.setMechanism( new LdapString(tlv.getValue().getData() ) );
+                        }
 
                         return;
                     }
                 } );
 
-        // AuthenticationChoice ::= CHOICE {
-        //        sasl         [3] saslCredentials }
-        //
-        // SaslCredentials ::= SEQUENCE {
-        //        mechanism     LDAPSTRING,  (Value)
-        //		  ...
-        // We have to store the mechanism.
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE][( 0x83 & 0x00FF )] =
-            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG,
-                new GrammarAction( "Create Bind sasl Authentication Object" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer   ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-
-                        BindRequest        bindRequestMessage = 
-                            ldapMessageContainer.getLdapMessage().getBindRequest();
-                        
-                        SaslCredentials saslAuthentication = bindRequestMessage.getSaslAuthentication();
-
-                        LdapString mechanism = new LdapString(
-                                ldapMessageContainer.getCurrentTLV().getValue().getData() );
-                        
-                        saslAuthentication.setMechanism( mechanism );
-                        
-                        return;
-                    }
-                } );
-
         //--------------------------------------------------------------------------------------------
         // SaslCredentials ::= SEQUENCE {
         //        ...
@@ -423,7 +308,7 @@
         // It's a credential if it's 0x04
         super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG][0x04] =
             new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_LENGTH, null );
+                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_VALUE, null );
 
         // It's a control if it's 0x80
         super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG][(0x80 & 0x00FF)] =
@@ -432,41 +317,6 @@
         
         // SaslCredentials ::= SEQUENCE {
         //        ...
-        //        credentials     OCTET STRING OPTIONAL } (Length)
-        // We just have to check the length
-        super.transitions[LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_LENGTH][0x04] =
-            new GrammarTransition( LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_LENGTH,
-                LdapStatesEnum.BIND_REQUEST_AUTHENTICATION_CREDENTIALS_VALUE,
-                new GrammarAction( "Check sasl authentication credentials length" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-                        
-                        BindRequest        bindRequestMessage = 
-                        ldapMessageContainer.getLdapMessage().getBindRequest();
-
-                        TLV           tlv    = ldapMessageContainer.getCurrentTLV();
-                        
-                        checkLength( bindRequestMessage, tlv );
-
-                        // We have to handle the special case of a 0 length credentials
-                        if (tlv.getLength().getLength() == 0)
-                        {
-                            SaslCredentials saslAuthentication = bindRequestMessage
-                                .getSaslAuthentication();
-
-                            saslAuthentication.setCredentials( new byte[]{} );
-                        }
-
-                        return;
-                    }
-                } );
-
-        // SaslCredentials ::= SEQUENCE {
-        //        ...
         //        credentials     OCTET STRING OPTIONAL } (Value)
         //
         // We have to get the Credentials and store it in the SaslCredentials.
@@ -489,13 +339,22 @@
                         BindRequest        bindRequestMessage = 
                         ldapMessageContainer.getLdapMessage().getBindRequest();
                         
-                        SaslCredentials saslAuthentication = bindRequestMessage
-                                .getSaslAuthentication();
-
                         // Get the Value and store it in the BindRequest
                         TLV           tlv         = ldapMessageContainer.getCurrentTLV();
 
-                        saslAuthentication.setCredentials( tlv.getValue().getData() );
+                        SaslCredentials credentials = bindRequestMessage
+                        .getSaslAuthentication();
+
+                        // We have to handle the special case of a 0 length credentials
+                        if (tlv.getLength().getLength() == 0)
+                        {
+                            credentials.setCredentials( OctetString.EMPTY_STRING );
+                        }
+                        else
+                        {
+                            credentials.setCredentials( new OctetString( tlv.getValue().getData() ) );
+                        }
+
                         return;
                     }
                 } );

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java Tue Jun 21 13:37:54 2005
@@ -26,6 +26,7 @@
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.BindResponse;
 import org.apache.asn1.ldap.pojo.LdapMessage;
+import org.apache.asn1.primitives.OctetString;
 
 import org.apache.log4j.Logger;
 
@@ -72,13 +73,13 @@
         //     ...
         // Nothing to do
         super.transitions[LdapStatesEnum.BIND_RESPONSE_TAG][0x61] = new GrammarTransition(
-                LdapStatesEnum.BIND_RESPONSE_TAG, LdapStatesEnum.BIND_RESPONSE_LENGTH, null );
+                LdapStatesEnum.BIND_RESPONSE_TAG, LdapStatesEnum.BIND_RESPONSE_VALUE, null );
 
         // LdapMessage ::= ... BindResponse ...
-        // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Length)
-        // We have to allocate a BindResponse
-        super.transitions[LdapStatesEnum.BIND_RESPONSE_LENGTH][0x61] = new GrammarTransition(
-                LdapStatesEnum.BIND_RESPONSE_LENGTH, LdapStatesEnum.BIND_RESPONSE_VALUE,
+        // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Value)
+        // We won't have a value. The next Tag will be the LDAPResult Tag (0x0A)
+        super.transitions[LdapStatesEnum.BIND_RESPONSE_VALUE][0x61] = new GrammarTransition(
+                LdapStatesEnum.BIND_RESPONSE_VALUE, LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
                 new GrammarAction( "Init BindReponse" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -89,30 +90,16 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
                         // Now, we can allocate the BindRequest Object
                         BindResponse bindResponse = new BindResponse();
 
                         // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        bindResponse.setExpectedLength( expectedLength );
-                        bindResponse.setCurrentLength( 0 );
                         bindResponse.setParent( ldapMessage );
 
                         // And we associate it to the ldapMessage Object
                         ldapMessage.setProtocolOP( bindResponse );
                     }
-                } );
-
-        // LdapMessage ::= ... BindResponse ...
-        // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Value)
-        // We won't have a value. The next Tag will be the LDAPResult Tag (0x0A)
-        super.transitions[LdapStatesEnum.BIND_RESPONSE_VALUE][0x61] = new GrammarTransition(
-                LdapStatesEnum.BIND_RESPONSE_VALUE, LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
-                null );
+                }  );
 
         // LdapMessage ::= ... BindResponse ...
         // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Value)
@@ -131,7 +118,7 @@
         //
         super.transitions[LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT][0x87] = new GrammarTransition(
                 LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
-                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH, null );
+                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_VALUE, null );
 
         // BindResponse ::= APPLICATION 1] SEQUENCE {
         //     ...
@@ -140,39 +127,7 @@
         // Otherwise, if the tag is 0x80, it's a control
         super.transitions[LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG][0x87] =
             new GrammarTransition( LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG,
-                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH, null );
-
-        // BindResponse ::= APPLICATION 1] SEQUENCE {
-        //     ...
-        //    serverSaslCreds   [7] OCTET STRING OPTIONAL } (Length)
-        // We have to check the length
-        super.transitions[LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH][0x87] =
-            new GrammarTransition( LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH,
-                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_VALUE,
-                new GrammarAction( "Check server sasl credentials length" )
-                {
-                    public void action( IAsn1Container container ) throws DecoderException
-                    {
-
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
-                            container;
-
-                        BindResponse     bindResponseMessage =
-                            ldapMessageContainer.getLdapMessage().getBindResponse();
-
-                        TLV                  tlv = ldapMessageContainer.getCurrentTLV();
-
-                        checkLength( bindResponseMessage, tlv );
-
-                        // We have to handle the special case of a 0 length server sasl credentials
-                        if ( tlv.getLength().getLength() == 0 )
-                        {
-                            bindResponseMessage.setServerSaslCreds( new byte[] {} );
-                        }
-
-                        return;
-                    }
-                } );
+                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_VALUE, null );
 
         // BindResponse ::= APPLICATION 1] SEQUENCE {
         //     ...
@@ -201,7 +156,16 @@
                         // Get the Value and store it in the BindRequest
                         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
-                        bindResponseMessage.setServerSaslCreds( tlv.getValue().getData() );
+                        // We have to handle the special case of a 0 length server sasl credentials
+                        if ( tlv.getLength().getLength() == 0 )
+                        {
+                            bindResponseMessage.setServerSaslCreds( OctetString.EMPTY_STRING );
+                        }
+                        else
+                        {
+                            bindResponseMessage.setServerSaslCreds( new OctetString( tlv.getValue().getData() ) );
+                        }
+                        
                         return;
                     }
                 } );

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/CompareResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/CompareResponseGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/CompareResponseGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/CompareResponseGrammar.java Tue Jun 21 13:37:54 2005
@@ -22,7 +22,6 @@
 import org.apache.asn1.ber.grammar.GrammarAction;
 import org.apache.asn1.ber.grammar.GrammarTransition;
 import org.apache.asn1.ber.grammar.IGrammar;
-import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.CompareResponse;
 import org.apache.asn1.ldap.pojo.LdapMessage;
@@ -69,13 +68,14 @@
         // CompareResponse ::= [APPLICATION 15] LDAPResult (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.COMPARE_RESPONSE_TAG][0x6F] = new GrammarTransition(
-                LdapStatesEnum.COMPARE_RESPONSE_TAG, LdapStatesEnum.COMPARE_RESPONSE_LENGTH, null );
+                LdapStatesEnum.COMPARE_RESPONSE_TAG, LdapStatesEnum.COMPARE_RESPONSE_VALUE, null );
 
-        // We have to allocate a CompareResponse
         // LdapMessage ::= ... CompareResponse ...
-        // CompareResponse ::= [APPLICATION 15] LDAPResult (Length)
-        super.transitions[LdapStatesEnum.COMPARE_RESPONSE_LENGTH][0x6F] = new GrammarTransition(
-                LdapStatesEnum.COMPARE_RESPONSE_LENGTH, LdapStatesEnum.COMPARE_RESPONSE_VALUE,
+        // CompareResponse ::= [APPLICATION 15] LDAPResult (Value)
+        // The next Tag will be the LDAPResult Tag (0x0A).
+        // We will switch the grammar then.
+        super.transitions[LdapStatesEnum.COMPARE_RESPONSE_VALUE][0x6F] = new GrammarTransition(
+                LdapStatesEnum.COMPARE_RESPONSE_VALUE, LdapStatesEnum.COMPARE_RESPONSE_LDAP_RESULT, 
                 new GrammarAction( "Init CompareResponse" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -86,30 +86,11 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
-                        // Now, we can allocate the AdddRequest Object
-                        CompareResponse compareResponse = new CompareResponse();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        compareResponse.setExpectedLength( expectedLength );
-                        compareResponse.setCurrentLength( 0 );
-                        compareResponse.setParent( ldapMessage );
-
+                        // Now, we can allocate the CompareResponse Object
                         // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( compareResponse );
+                        ldapMessage.setProtocolOP( new CompareResponse() );
                     }
                 } );
-
-        // LdapMessage ::= ... CompareResponse ...
-        // CompareResponse ::= [APPLICATION 15] LDAPResult (Value)
-        // The next Tag will be the LDAPResult Tag (0x0A).
-        // We will switch the grammar then.
-        super.transitions[LdapStatesEnum.COMPARE_RESPONSE_VALUE][0x6F] = new GrammarTransition(
-                LdapStatesEnum.COMPARE_RESPONSE_VALUE, LdapStatesEnum.COMPARE_RESPONSE_LDAP_RESULT, null );
 
         // LdapMessage ::= ... CompareResponse ...
         // CompareResponse ::= [APPLICATION 15] LDAPResult (Value)

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/DelResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/DelResponseGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/DelResponseGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/DelResponseGrammar.java Tue Jun 21 13:37:54 2005
@@ -22,7 +22,6 @@
 import org.apache.asn1.ber.grammar.GrammarAction;
 import org.apache.asn1.ber.grammar.GrammarTransition;
 import org.apache.asn1.ber.grammar.IGrammar;
-import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.DelResponse;
 import org.apache.asn1.ldap.pojo.LdapMessage;
@@ -69,13 +68,14 @@
         // DelResponse ::= [APPLICATION 11] LDAPResult (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.DEL_RESPONSE_TAG][0x6B] = new GrammarTransition(
-                LdapStatesEnum.DEL_RESPONSE_TAG, LdapStatesEnum.DEL_RESPONSE_LENGTH, null );
+                LdapStatesEnum.DEL_RESPONSE_TAG, LdapStatesEnum.DEL_RESPONSE_VALUE, null );
 
-        // We have to allocate a DelResponse
         // LdapMessage ::= ... DelResponse ...
-        // DelResponse ::= [APPLICATION 11] LDAPResult (Length)
-        super.transitions[LdapStatesEnum.DEL_RESPONSE_LENGTH][0x6B] = new GrammarTransition(
-                LdapStatesEnum.DEL_RESPONSE_LENGTH, LdapStatesEnum.DEL_RESPONSE_VALUE,
+        // DelResponse ::= [APPLICATION 11] LDAPResult (Value)
+        // The next Tag will be the LDAPResult Tag (0x0A).
+        // We will switch the grammar then.
+        super.transitions[LdapStatesEnum.DEL_RESPONSE_VALUE][0x6B] = new GrammarTransition(
+                LdapStatesEnum.DEL_RESPONSE_VALUE, LdapStatesEnum.DEL_RESPONSE_LDAP_RESULT, 
                 new GrammarAction( "Init DelResponse" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -86,30 +86,12 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
                         // Now, we can allocate the DelResponse Object
-                        DelResponse delResponse = new DelResponse();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        delResponse.setExpectedLength( expectedLength );
-                        delResponse.setCurrentLength( 0 );
-                        delResponse.setParent( ldapMessage );
 
                         // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( delResponse );
+                        ldapMessage.setProtocolOP( new DelResponse() );
                     }
                 } );
-
-        // LdapMessage ::= ... DelResponse ...
-        // DelResponse ::= [APPLICATION 11] LDAPResult (Value)
-        // The next Tag will be the LDAPResult Tag (0x0A).
-        // We will switch the grammar then.
-        super.transitions[LdapStatesEnum.DEL_RESPONSE_VALUE][0x6B] = new GrammarTransition(
-                LdapStatesEnum.DEL_RESPONSE_VALUE, LdapStatesEnum.DEL_RESPONSE_LDAP_RESULT, null );
 
         // LdapMessage ::= ... DelResponse ...
         // DelResponse ::= [APPLICATION 11] LDAPResult (Value)

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java Tue Jun 21 13:37:54 2005
@@ -22,7 +22,6 @@
 import org.apache.asn1.ber.grammar.GrammarAction;
 import org.apache.asn1.ber.grammar.GrammarTransition;
 import org.apache.asn1.ber.grammar.IGrammar;
-import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.ModifyDNResponse;
@@ -69,13 +68,14 @@
         // ModifyDNResponse ::= [APPLICATION 13] LDAPResult (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.MODIFY_RESPONSE_TAG][0x6D] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_RESPONSE_TAG, LdapStatesEnum.MODIFY_RESPONSE_LENGTH, null );
+                LdapStatesEnum.MODIFY_RESPONSE_TAG, LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE, null );
 
-        // We have to allocate a ModifyDNResponse
-        // LdapMessage ::= ... ModifyResponse ...
-        // ModifyDNResponse ::= [APPLICATION 13] LDAPResult (Length)
-        super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_LENGTH][0x6D] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_DN_RESPONSE_LENGTH, LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE,
+        // LdapMessage ::= ... ModifyDNResponse ...
+        // ModifyDNResponse ::= [APPLICATION 13] LDAPResult (Value)
+        // The next Tag will be the LDAPResult Tag (0x0A).
+        // We will switch the grammar then.
+        super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE][0x6D] = new GrammarTransition(
+                LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE, LdapStatesEnum.MODIFY_DN_RESPONSE_LDAP_RESULT, 
                 new GrammarAction( "Init ModifyDNResponse" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -86,30 +86,10 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
-                        // Now, we can allocate the ModifyDNResponse Object
-                        ModifyDNResponse modifyDNResponse = new ModifyDNResponse();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        modifyDNResponse.setExpectedLength( expectedLength );
-                        modifyDNResponse.setCurrentLength( 0 );
-                        modifyDNResponse.setParent( ldapMessage );
-
                         // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( modifyDNResponse );
+                        ldapMessage.setProtocolOP( new ModifyDNResponse() );
                     }
                 } );
-
-        // LdapMessage ::= ... ModifyDNResponse ...
-        // ModifyDNResponse ::= [APPLICATION 13] LDAPResult (Value)
-        // The next Tag will be the LDAPResult Tag (0x0A).
-        // We will switch the grammar then.
-        super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE][0x6D] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE, LdapStatesEnum.MODIFY_DN_RESPONSE_LDAP_RESULT, null );
 
         // LdapMessage ::= ... ModifyDNResponse ...
         // ModifyDNResponse ::= [APPLICATION 13] LDAPResult (Value)

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyResponseGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyResponseGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyResponseGrammar.java Tue Jun 21 13:37:54 2005
@@ -22,7 +22,6 @@
 import org.apache.asn1.ber.grammar.GrammarAction;
 import org.apache.asn1.ber.grammar.GrammarTransition;
 import org.apache.asn1.ber.grammar.IGrammar;
-import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.ModifyResponse;
@@ -69,13 +68,14 @@
         // ModifyResponse ::= [APPLICATION 7] LDAPResult (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.MODIFY_RESPONSE_TAG][0x67] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_RESPONSE_TAG, LdapStatesEnum.MODIFY_RESPONSE_LENGTH, null );
+                LdapStatesEnum.MODIFY_RESPONSE_TAG, LdapStatesEnum.MODIFY_RESPONSE_VALUE, null );
 
-        // We have to allocate a ModifyResponse
         // LdapMessage ::= ... ModifyResponse ...
-        // ModifyResponse ::= [APPLICATION 7] LDAPResult (Length)
-        super.transitions[LdapStatesEnum.MODIFY_RESPONSE_LENGTH][0x67] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_RESPONSE_LENGTH, LdapStatesEnum.MODIFY_RESPONSE_VALUE,
+        // ModifyResponse ::= [APPLICATION 7] LDAPResult (Value)
+        // The next Tag will be the LDAPResult Tag (0x0A).
+        // We will switch the grammar then.
+        super.transitions[LdapStatesEnum.MODIFY_RESPONSE_VALUE][0x67] = new GrammarTransition(
+                LdapStatesEnum.MODIFY_RESPONSE_VALUE, LdapStatesEnum.MODIFY_RESPONSE_LDAP_RESULT, 
                 new GrammarAction( "Init ModifyResponse" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -86,30 +86,10 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
-                        // Now, we can allocate the ModifyResponse Object
-                        ModifyResponse modifyResponse = new ModifyResponse();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        modifyResponse.setExpectedLength( expectedLength );
-                        modifyResponse.setCurrentLength( 0 );
-                        modifyResponse.setParent( ldapMessage );
-
-                        // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( modifyResponse );
+                        // We associate it to the ldapMessage Object
+                        ldapMessage.setProtocolOP( new ModifyResponse() );
                     }
                 } );
-
-        // LdapMessage ::= ... ModifyResponse ...
-        // ModifyResponse ::= [APPLICATION 7] LDAPResult (Value)
-        // The next Tag will be the LDAPResult Tag (0x0A).
-        // We will switch the grammar then.
-        super.transitions[LdapStatesEnum.MODIFY_RESPONSE_VALUE][0x67] = new GrammarTransition(
-                LdapStatesEnum.MODIFY_RESPONSE_VALUE, LdapStatesEnum.MODIFY_RESPONSE_LDAP_RESULT, null );
 
         // LdapMessage ::= ... ModifyResponse ...
         // ModifyResponse ::= [APPLICATION 7] LDAPResult (Value)

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchResultDoneGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchResultDoneGrammar.java?rev=191721&r1=191720&r2=191721&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchResultDoneGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchResultDoneGrammar.java Tue Jun 21 13:37:54 2005
@@ -22,7 +22,6 @@
 import org.apache.asn1.ber.grammar.GrammarAction;
 import org.apache.asn1.ber.grammar.GrammarTransition;
 import org.apache.asn1.ber.grammar.IGrammar;
-import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.SearchResultDone;
@@ -69,13 +68,14 @@
         // SearchResultDone ::= [APPLICATION 5] LDAPResult (Tag)
         // Nothing to do.
         super.transitions[LdapStatesEnum.SEARCH_RESULT_DONE_TAG][0x65] = new GrammarTransition(
-                LdapStatesEnum.SEARCH_RESULT_DONE_TAG, LdapStatesEnum.SEARCH_RESULT_DONE_LENGTH, null );
+                LdapStatesEnum.SEARCH_RESULT_DONE_TAG, LdapStatesEnum.SEARCH_RESULT_DONE_VALUE, null );
 
-        // We have to allocate a SearchResultDone
         // LdapMessage ::= ... SearchResultDone ...
-        // SearchResultDone ::= [APPLICATION 5] LDAPResult (Length)
-        super.transitions[LdapStatesEnum.SEARCH_RESULT_DONE_LENGTH][0x65] = new GrammarTransition(
-                LdapStatesEnum.SEARCH_RESULT_DONE_LENGTH, LdapStatesEnum.SEARCH_RESULT_DONE_VALUE,
+        // SearchResultDone ::= [APPLICATION 5] LDAPResult (Value)
+        // The next Tag will be the LDAPResult Tag (0x0A).
+        // We will switch the grammar then.
+        super.transitions[LdapStatesEnum.SEARCH_RESULT_DONE_VALUE][0x65] = new GrammarTransition(
+                LdapStatesEnum.SEARCH_RESULT_DONE_VALUE, LdapStatesEnum.SEARCH_RESULT_DONE_LDAP_RESULT, 
                 new GrammarAction( "Init search Result Done" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -86,30 +86,10 @@
                         LdapMessage      ldapMessage          =
                             ldapMessageContainer.getLdapMessage();
 
-                        checkLength( ldapMessageContainer.getLdapMessage(),
-                            ldapMessageContainer.getCurrentTLV() );
-
                         // Now, we can allocate the SearchResultDone Object
-                        SearchResultDone searchResultDone = new SearchResultDone();
-
-                        // As this is a new Constructed object, we have to init its length
-                        TLV tlv            = ldapMessageContainer.getCurrentTLV();
-                        int expectedLength = tlv.getLength().getLength();
-                        searchResultDone.setExpectedLength( expectedLength );
-                        searchResultDone.setCurrentLength( 0 );
-                        searchResultDone.setParent( ldapMessage );
-
-                        // And we associate it to the ldapMessage Object
-                        ldapMessage.setProtocolOP( searchResultDone );
+                        ldapMessage.setProtocolOP( new SearchResultDone() );
                     }
                 } );
-
-        // LdapMessage ::= ... SearchResultDone ...
-        // SearchResultDone ::= [APPLICATION 5] LDAPResult (Value)
-        // The next Tag will be the LDAPResult Tag (0x0A).
-        // We will switch the grammar then.
-        super.transitions[LdapStatesEnum.SEARCH_RESULT_DONE_VALUE][0x65] = new GrammarTransition(
-                LdapStatesEnum.SEARCH_RESULT_DONE_VALUE, LdapStatesEnum.SEARCH_RESULT_DONE_LDAP_RESULT, null );
 
         // LdapMessage ::= ... SearchResultDone ...
         // SearchResultDone ::= [APPLICATION 5] LDAPResult (Value)