directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r372169 - in /directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec: ./ bind/ modify/ search/
Date Wed, 25 Jan 2006 09:20:48 GMT
Author: elecharny
Date: Wed Jan 25 01:20:39 2006
New Revision: 372169

URL: http://svn.apache.org/viewcvs?rev=372169&view=rev
Log:
- Added the grammarPopAllowed() method when necessary in th grammars
- Fixed a state which was not allowed for MatchingRuleAssertion grammar

Modified:
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapMessageContainer.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapStatesEnum.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/FilterGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/MatchingRuleAssertionGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SubstringFilterGrammar.java

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapMessageContainer.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapMessageContainer.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapMessageContainer.java
Wed Jan 25 01:20:39 2006
@@ -87,6 +87,7 @@
         grammars = new IGrammar[LdapStatesEnum.NB_GRAMMARS];
         grammarStack = new IGrammar[10];
         stateStack = new int[10];
+        popAllowedStack = new boolean[10];
         nbGrammars = 0;
 
         grammars[LdapStatesEnum.LDAP_MESSAGE_GRAMMAR] = LdapMessageGrammar.getInstance();

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
Wed Jan 25 01:20:39 2006
@@ -356,6 +356,9 @@
                         {
                             log.debug( "The error message is : " + ldapResult.getErrorMessage()
);
                         }
+
+                        // We cazn pop this grammar
+                        container.grammarPopAllowed( true );
                         
                         return;
                     }
@@ -378,12 +381,12 @@
         // This is a referral.
         super.transitions[LdapStatesEnum.LDAP_RESULT_REFERRAL_SEQUENCE_TAG][LdapConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG]
=
             new GrammarTransition( LdapStatesEnum.LDAP_RESULT_REFERRAL_SEQUENCE_TAG,
-                LdapStatesEnum.LDAP_RESULT_REFERRAL_TAG, null );
+                LdapStatesEnum.LDAP_RESULT_REFERRAL_TAG, null);
 
         // In case we are coming from a error message state
         super.transitions[LdapStatesEnum.LDAP_RESULT_ERROR_MESSAGE_VALUE][LdapConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG]
=
             new GrammarTransition( LdapStatesEnum.LDAP_RESULT_ERROR_MESSAGE_VALUE,
-                LdapStatesEnum.LDAP_RESULT_REFERRAL_TAG, null );
+                LdapStatesEnum.LDAP_RESULT_REFERRAL_TAG, null);
 
         // Referral ::= SEQUENCE OF LDAPURL (Tag)
         // This is a SEQUENCE, we will have at least one referral, but may be many.

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapStatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapStatesEnum.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapStatesEnum.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/LdapStatesEnum.java
Wed Jan 25 01:20:39 2006
@@ -584,7 +584,7 @@
 
     // Matching rule assertion Matching rule ---------------------------------------------------
     /** Matching rule assertion matching rule assertion rule Tag */
-    public static int MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG =
2;
+    public static int MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG = 2;
 
     /** Matching rule assertion matching rule Value */
     public static int MATCHING_RULE_ASSERTION_MATCHING_RULE_VALUE = 3;
@@ -1544,7 +1544,7 @@
         {
             "MATCHING_RULE_ASSERTION_TAG",
             "MATCHING_RULE_ASSERTION_VALUE",
-            "MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG",
+            "MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG",
             "MATCHING_RULE_ASSERTION_MATCHING_RULE_VALUE",
             "MATCHING_RULE_ASSERTION_TYPE_OR_MATCH_VALUE_TAG",
             "MATCHING_RULE_ASSERTION_TYPE_VALUE",

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
Wed Jan 25 01:20:39 2006
@@ -23,6 +23,7 @@
 import org.apache.asn1.ber.IAsn1Container;
 import org.apache.asn1.ber.tlv.UniversalTag;
 import org.apache.asn1.ber.tlv.TLV;
+import org.apache.asn1.codec.DecoderException;
 import org.apache.ldap.common.codec.LdapConstants;
 import org.apache.ldap.common.codec.LdapMessage;
 import org.apache.ldap.common.codec.LdapMessageContainer;
@@ -105,7 +106,13 @@
         // The current state will be stored.
         super.transitions[LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT][UniversalTag.ENUMERATED_TAG]
= new GrammarTransition(
                 LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT, LdapStatesEnum.LDAP_RESULT_GRAMMAR_SWITCH,
-                null );
+                new GrammarAction( "Allow pop" )
+                {
+                    public void action( IAsn1Container container ) throws DecoderException
+                    {
+                        container.grammarPopAllowed( true );
+                    }
+                } );
 
         // LdapMessage ::= ... BindResponse ...
         // BindResponse ::= [APPLICATION 1] SEQUENCE {

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
Wed Jan 25 01:20:39 2006
@@ -224,7 +224,7 @@
         super.transitions[LdapStatesEnum.MODIFY_REQUEST_ATTRIBUTE_VALUE_OR_MODIFICATION_TAG][UniversalTag.SEQUENCE_TAG]
=
             new GrammarTransition(
                 LdapStatesEnum.MODIFY_REQUEST_ATTRIBUTE_VALUE_OR_MODIFICATION_TAG,
-                LdapStatesEnum.MODIFY_REQUEST_MODIFICATION_SEQUENCE_VALUE, null );
+                LdapStatesEnum.MODIFY_REQUEST_MODIFICATION_SEQUENCE_VALUE, null);
 
         // LdapMessage ::= ... ModifyRequest ...
         // ModifyRequest ::= [APPLICATION 6] SEQUENCE {
@@ -507,6 +507,9 @@
                         
                         // We can have an END transition
                         ldapMessageContainer.grammarEndAllowed( true );
+                        
+                        // We can have an Pop transition
+                        ldapMessageContainer.grammarPopAllowed( true );
                         
                         log.debug( "Value modified : {}", value );
                     }

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/FilterGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/FilterGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/FilterGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/FilterGrammar.java
Wed Jan 25 01:20:39 2006
@@ -170,7 +170,14 @@
         //     ...
         // Nothing to do
         super.transitions[LdapStatesEnum.FILTER_TAG][LdapConstants.SUBSTRINGS_FILTER_TAG]
= new GrammarTransition(
-                LdapStatesEnum.FILTER_TAG, LdapStatesEnum.SUBSTRING_FILTER_GRAMMAR_SWITCH,
null );
+                LdapStatesEnum.FILTER_TAG, LdapStatesEnum.SUBSTRING_FILTER_GRAMMAR_SWITCH,

+                new GrammarAction( "Allow pop" )
+                {
+                    public void action( IAsn1Container container ) throws DecoderException
+                    {
+                        container.grammarPopAllowed( true );
+                    }
+                });
 
         // Filter ::= CHOICE {
         //     ...
@@ -209,7 +216,14 @@
         //     extensibleMatch [9] ExtensibleMatchFilter } (Tag)
         // Nothing to do
         super.transitions[LdapStatesEnum.FILTER_TAG][LdapConstants.EXTENSIBLE_MATCH_FILTER_TAG]
= new GrammarTransition(
-                LdapStatesEnum.FILTER_TAG, LdapStatesEnum.MATCHING_RULE_ASSERTION_GRAMMAR_SWITCH,
null );
+                LdapStatesEnum.FILTER_TAG, LdapStatesEnum.MATCHING_RULE_ASSERTION_GRAMMAR_SWITCH,
                
+                new GrammarAction( "Allow pop" )
+                {
+                    public void action( IAsn1Container container ) throws DecoderException
+                    {
+                        container.grammarPopAllowed( true );
+                    }
+                });
 
         // Filter ::= CHOICE {
         //     and             [0] SET OF Filter, (Value)
@@ -523,6 +537,7 @@
                         
                         // We now have to get back to the nearest filter which is not terminal.
                         unstackFilters( container );
+                        container.grammarPopAllowed( true );
                     }
                 });
 
@@ -643,6 +658,7 @@
                             
                         // We now have to get back to the nearest filter which is not terminal.
                         unstackFilters( container );
+                        container.grammarPopAllowed( true );
                     }
                 } );
 
@@ -679,7 +695,7 @@
         // Get the parent, if any
         Filter currentFilter = searchRequest.getCurrentFilter();
 
-        // We know have to check if the parent has been completed
+        // We now have to check if the parent has been completed
 	    if (tlv.getParent().getExpectedLength() == 0)
 	    {
 	        TLV parent = tlv.getParent();

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/MatchingRuleAssertionGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/MatchingRuleAssertionGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/MatchingRuleAssertionGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/MatchingRuleAssertionGrammar.java
Wed Jan 25 01:20:39 2006
@@ -84,7 +84,7 @@
                 LdapStatesEnum.MATCHING_RULE_ASSERTION_TAG, LdapStatesEnum.MATCHING_RULE_ASSERTION_VALUE,
null );
 
         super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_VALUE][LdapConstants.EXTENSIBLE_MATCH_FILTER_TAG]
= new GrammarTransition(
-                LdapStatesEnum.MATCHING_RULE_ASSERTION_VALUE, LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG,

+                LdapStatesEnum.MATCHING_RULE_ASSERTION_VALUE, LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG,

                 new GrammarAction( "Init extensible match Filter" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
@@ -126,8 +126,8 @@
         //          matchingRule    [1] MatchingRuleId OPTIONAL, (Tag)
         //          ...
         // Nothing to do
-        super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG][LdapConstants.SEARCH_MATCHING_RULE_TAG]
= new GrammarTransition(
-                LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG,
LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_VALUE, null );
+        super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG][LdapConstants.SEARCH_MATCHING_RULE_TAG]
= new GrammarTransition(
+                LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG, LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_VALUE,
null );
 
         // MatchingRuleAssertion ::= SEQUENCE {
         //          matchingRule    [1] MatchingRuleId OPTIONAL, (Value)
@@ -177,8 +177,8 @@
         //          ...
         // Nothing to do.
         // Nothing to do.
-        super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG][LdapConstants.MATCHING_RULE_ASSERTION_TYPE_TAG]
= new GrammarTransition(
-                LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG,
LdapStatesEnum.MATCHING_RULE_ASSERTION_TYPE_VALUE, null );
+        super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG][LdapConstants.MATCHING_RULE_ASSERTION_TYPE_TAG]
= new GrammarTransition(
+                LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_TAG, LdapStatesEnum.MATCHING_RULE_ASSERTION_TYPE_VALUE,
null );
 
                 
         // MatchingRuleAssertion ::= SEQUENCE { 
@@ -208,33 +208,32 @@
 
                         TLV tlv            = ldapMessageContainer.getCurrentTLV();
 
-                        // Store the value.
-                        ExtensibleMatchFilter extensibleMatchFilter = (ExtensibleMatchFilter)searchRequest.getCurrentFilter();
-                        
-                        try
+                        if ( tlv.getLength().getLength() == 0 )
                         {
-                            LdapString type = LdapDN.normalizeAttribute( tlv.getValue().getData()
);
-                            extensibleMatchFilter.setType( type );
+                            log.error( "The type cannot be null in a MacthingRuleAssertion"
);
+                            throw new DecoderException( "The type cannot be null in a MacthingRuleAssertion"
);
                         }
-                        catch ( LdapStringEncodingException lsee )
+                        else
                         {
-                            String msg = StringTools.dumpBytes( tlv.getValue().getData()
);
-                            log.error( "The match filter ({}) is invalid", msg );
-                            throw new DecoderException( "Invalid match filter " + msg + ",
: " + lsee.getMessage() );
+                            // Store the value.
+                            ExtensibleMatchFilter extensibleMatchFilter = (ExtensibleMatchFilter)searchRequest.getCurrentFilter();
+                            
+                            try
+                            {
+                                LdapString type = LdapDN.normalizeAttribute( tlv.getValue().getData()
);
+                                extensibleMatchFilter.setType( type );
+                            }
+                            catch ( LdapStringEncodingException lsee )
+                            {
+                                String msg = StringTools.dumpBytes( tlv.getValue().getData()
);
+                                log.error( "The match filter ({}) is invalid", msg );
+                                throw new DecoderException( "Invalid match filter " + msg
+ ", : " + lsee.getMessage() );
+                            }
                         }
                     }
                 });
                 
         // MatchingRuleAssertion ::= SEQUENCE { 
-        //          (void),
-        //          (void),
-        //          matchValue      [3] AssertionValue, (Tag)
-        //          ...
-        // Nothing to do.
-        super.transitions[LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG][LdapConstants.SEARCH_MATCH_VALUE_TAG]
= new GrammarTransition(
-                LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCHING_RULE_OR_TYPE_OR_MATCH_VALUE_TAG,
LdapStatesEnum.MATCHING_RULE_ASSERTION_MATCH_VALUE_VALUE, null );
-
-        // MatchingRuleAssertion ::= SEQUENCE { 
         //          matchingRule    [1] MatchingRuleId OPTIONAL,
         //          (void),
         //          matchValue      [3] AssertionValue, (Tag)
@@ -274,6 +273,9 @@
                         // Store the value.
                         ExtensibleMatchFilter extensibleMatchFilter = (ExtensibleMatchFilter)searchRequest.getCurrentFilter();
                         extensibleMatchFilter.setMatchValue( StringTools.utf8ToString( tlv.getValue().getData()
) );
+
+                        // We can have a pop transition
+                        ldapMessageContainer.grammarPopAllowed( true );
                     }
                 });
                 
@@ -329,6 +331,9 @@
                         {
                             log.debug( "DN Attributes : {}", new Boolean( extensibleMatchFilter.isDnAttributes()
) );
                         }
+                        
+                        // We can have a pop transition
+                        ldapMessageContainer.grammarPopAllowed( true );
                     }
                 });
     }

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
Wed Jan 25 01:20:39 2006
@@ -661,6 +661,9 @@
                         // We can have an END transition
                         ldapMessageContainer.grammarEndAllowed( true );
 
+                        // We can have an Pop transition
+                        ldapMessageContainer.grammarPopAllowed( true );
+                        
                         return;
                     }
                 } );
@@ -713,6 +716,9 @@
                             
                         // We can have an END transition
                         ldapMessageContainer.grammarEndAllowed( true );
+
+                        // We can have a pop transition
+                        ldapMessageContainer.grammarPopAllowed( true );
 
                         if ( log.isDebugEnabled() )
                         {

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SubstringFilterGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SubstringFilterGrammar.java?rev=372169&r1=372168&r2=372169&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SubstringFilterGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/search/SubstringFilterGrammar.java
Wed Jan 25 01:20:39 2006
@@ -275,6 +275,9 @@
 
                         // We now have to get back to the nearest filter which is not terminal.
                         unstackFilters( container );
+
+                        // We can have a pop transition
+                        container.grammarPopAllowed( true );
                     }
                 });
                 
@@ -344,6 +347,9 @@
 
                         // We now have to get back to the nearest filter which is not terminal.
                         unstackFilters( container );
+
+                        // We can have a pop transition
+                        container.grammarPopAllowed( true );
                     }
                 });
                 
@@ -403,6 +409,8 @@
 
                         // We now have to get back to the nearest filter which is not terminal.
                         unstackFilters( container );
+                        // We can have a pop transition
+                        container.grammarPopAllowed( true );
                     }
                 });
                 
@@ -456,7 +464,7 @@
 	            else
 	            {
 	                currentFilter = null;
-	                break;
+                    break;
 	            }
 	        }
 	        



Mime
View raw message