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/09 00:00:57 UTC

svn commit: r189651 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java

Author: elecharny
Date: Wed Jun  8 15:00:57 2005
New Revision: 189651

URL: http://svn.apache.org/viewcvs?rev=189651&view=rev
Log:
This class was not abstract enough ! Deleted the references to ldapObject and reference the 
new container's method getStates which gives the grammar name, instead of invocing LdapStateEnum 
(which is not very good when decoding Spnego grammar ...)

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java?rev=189651&r1=189650&r2=189651&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java Wed Jun  8 15:00:57 2005
@@ -21,7 +21,6 @@
 import org.apache.asn1.ber.containers.IAsn1Container;
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ber.tlv.Tag;
-import org.apache.asn1.ldap.codec.grammars.LdapStatesEnum;
 import org.apache.asn1.util.StringUtils;
 
 import org.apache.log4j.Logger;
@@ -82,12 +81,12 @@
      * The current Object contains the sum of all included Objects and element, which is
      * compared with the PDU's expected length (the Length part of the PDU containing the Object).
      * 
-     * @param ldapObject The Object that is being decoded.
+     * @param object The Object that is being decoded.
      * @param tlv The current TLV
      * @throws DecoderException Thrown if the expected length is lower than the sum
      * of all the included elements.
      */
-    protected void checkLength( Asn1Object ldapObject, TLV tlv ) throws DecoderException
+    protected void checkLength( Asn1Object object, TLV tlv ) throws DecoderException
     {
 
         // Create a new expected Length
@@ -98,15 +97,15 @@
         if ( DEBUG )
         {
             log.debug(
-                "Expected Length = " + ( ( Asn1Object ) ldapObject ).getExpectedLength() +
-                ", current length = " + ( ( Asn1Object ) ldapObject ).getCurrentLength() +
+                "Expected Length = " + ( ( Asn1Object ) object ).getExpectedLength() +
+                ", current length = " + ( ( Asn1Object ) object ).getCurrentLength() +
                 ", added length = " + expectedLength +
                 ", tlv length = " + tlvLength );
         }
 
         // We already are at the top level.
         // An exception will be thrown if the current length exceed the expected length
-        ( ( Asn1Object ) ldapObject ).addLength( expectedLength + tlvLength );
+        ( ( Asn1Object ) object ).addLength( expectedLength + tlvLength );
     }
 
     /**
@@ -193,8 +192,8 @@
                 {
                     log.debug(
                         "Switching from grammar " +
-                        LdapStatesEnum.getGrammarName( currentGrammar ) +
-                        " to grammar " + LdapStatesEnum.getGrammarName( ( nextState >> 8 ) - 1 ) );
+                        container.getStates().getGrammarName( currentGrammar ) +
+                        " to grammar " + container.getStates().getGrammarName( ( nextState >> 8 ) - 1 ) );
                 }
 
                 // We have a grammar switch, so we change the current state to the initial