directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r368663 - in /directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec: ./ abandon/ add/ bind/ compare/ del/ extended/ modify/ modifyDn/ search/ search/controls/ unbind/
Date Fri, 13 Jan 2006 10:00:50 GMT
Author: elecharny
Date: Fri Jan 13 02:00:32 2006
New Revision: 368663

URL: http://svn.apache.org/viewcvs?rev=368663&view=rev
Log:
Fixed the bug DIRSNICKERS-121.
- Added the flag that allow Grammar ends in all the grammars
- Modified some of the logs

Modified:
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapMessageGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/add/AddRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/compare/CompareRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/del/DelRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedResponseGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modifyDn/ModifyDNRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultEntryGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultReferenceGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/EntryChangeControlGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlGrammar.java
    directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/unbind/UnBindRequestGrammar.java

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
Fri Jan 13 02:00:32 2006
@@ -90,6 +90,9 @@
             control.setControlValue( decoded );
         }
         
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
+        
         if ( log.isDebugEnabled() )
         {
             if ( control.getControlValue() instanceof byte[] )

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
Fri Jan 13 02:00:32 2006
@@ -160,7 +160,9 @@
                 LdapStatesEnum.CONTROL_TYPE_TAG,
                 LdapStatesEnum.CONTROL_TYPE_VALUE, null );
 
-        // Control ::= SEQUENCE { (Value)
+        // Control ::= SEQUENCE {
+        //    controlType  LDAPOID, (Value)
+        //
         // Store the value in the control object created before
         super.transitions[LdapStatesEnum.CONTROL_TYPE_VALUE][UniversalTag.OCTET_STRING_TAG]
= new GrammarTransition(
                 LdapStatesEnum.CONTROL_TYPE_VALUE, LdapStatesEnum.CONTROL_LOOP_OR_CRITICAL_OR_VALUE_TAG,

@@ -213,6 +215,9 @@
                         	}
                         }
                         
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "Control OID : " + control.getControlType() );
@@ -270,6 +275,9 @@
                         
                             throw new DecoderException( bde.getMessage() );
                         }
+                        
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                         
                         if ( log.isDebugEnabled() )
                         {

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapMessageGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapMessageGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapMessageGrammar.java
Fri Jan 13 02:00:32 2006
@@ -70,8 +70,13 @@
         // LDAPMessage --> SEQUENCE { ... (Tag)
         // We have a LDAPMessage, and the tag must be 0x30
         super.transitions[LdapStatesEnum.LDAP_MESSAGE_TAG][UniversalTag.SEQUENCE_TAG] = new
GrammarTransition(
-                LdapStatesEnum.LDAP_MESSAGE_TAG, LdapStatesEnum.LDAP_MESSAGE_VALUE,
-                new GrammarAction( "LdapMessage Tag" )
+                LdapStatesEnum.LDAP_MESSAGE_TAG, LdapStatesEnum.LDAP_MESSAGE_VALUE, null
);
+
+         // LDAPMessage --> SEQUENCE { ... (Value)
+        // Nothing to do, it's a constructed TLV. It's just a phantom transition ...
+        super.transitions[LdapStatesEnum.LDAP_MESSAGE_VALUE][UniversalTag.SEQUENCE_TAG] =
new GrammarTransition(
+                LdapStatesEnum.LDAP_MESSAGE_VALUE, LdapStatesEnum.LDAP_MESSAGE_ID_TAG, 
+                new GrammarAction( "LdapMessage initialization" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
@@ -79,21 +84,26 @@
                         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer
)
                             container;
 
+                        TLV   tlv       = ldapMessageContainer.getCurrentTLV();
+
+                        // The Length should not be null
+                        if ( tlv.getLength().getLength() == 0 )
+                        {
+                        	log.error( "The LdapMessage has a zero length. This is not allowed"
);
+                        	throw new DecoderException( "The LdapMessage should not be empty"
);
+                        }
+
                         // First, create a empty LdapMessage Object
                         LdapMessage ldapMessage = new LdapMessage();
 
                         // Then stores it into the container
                         ldapMessageContainer.setLdapMessage( ldapMessage );
+                        ldapMessageContainer.grammarEndAllowed( false );
 
                         return;
                     }
                 } );
 
-         // LDAPMessage --> SEQUENCE { ... (Value)
-        // Nothing to do, it's a constructed TLV. It's just a phantom transition ...
-        super.transitions[LdapStatesEnum.LDAP_MESSAGE_VALUE][UniversalTag.SEQUENCE_TAG] =
new GrammarTransition(
-                LdapStatesEnum.LDAP_MESSAGE_VALUE, LdapStatesEnum.LDAP_MESSAGE_ID_TAG, null
);
-
         //--------------------------------------------------------------------------------------------
         // LdapMessage Message ID
         //--------------------------------------------------------------------------------------------
@@ -120,6 +130,13 @@
                         // The current TLV should be a integer
                         // We get it and store it in MessageId
                         TLV   tlv       = ldapMessageContainer.getCurrentTLV();
+                        
+                        // The Length should not be null
+                        if ( tlv.getLength().getLength() == 0 )
+                        {
+                        	log.error( "The messageId has a zero length. This is not allowed"
);
+                        	throw new DecoderException( "The messageId should not be null" );
+                        }
 
                         Value value     = tlv.getValue();
 

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapResultGrammar.java
Fri Jan 13 02:00:32 2006
@@ -349,6 +349,9 @@
                             }
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "The error message is : " + ldapResult.getErrorMessage()
);
@@ -441,6 +444,9 @@
                                 ldapResult.addReferral( LdapURL.EMPTY_URL );
                             }
                         }
+                        
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                         
                         if ( log.isDebugEnabled() )
                         {

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -117,6 +117,7 @@
                                 log.debug( "AbandonMessage Id has been decoded : " + abandonnedMessageId
);
                             }
 
+                            ldapMessageContainer.grammarEndAllowed( true );
                             return;
                         }
                         catch ( IntegerDecoderException ide )

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/add/AddRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/add/AddRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/add/AddRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/add/AddRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -34,7 +34,6 @@
 import org.apache.ldap.common.codec.LdapStatesEnum;
 import org.apache.ldap.common.codec.util.LdapString;
 import org.apache.ldap.common.codec.util.LdapStringEncodingException;
-//import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
@@ -372,6 +371,9 @@
                             
                             addRequest.addAttributeValue( value );
                         }
+
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                     }
                 } );
 

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -106,7 +106,6 @@
                 {
                     public void action( IAsn1Container container )
                     {
-
                         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer
)
                             container;
                         LdapMessage      ldapMessage          =
@@ -285,6 +284,9 @@
                             authentication.setSimple( tlv.getValue().getData() );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "The simple authentication is : " + authentication.getSimple()
);
@@ -355,6 +357,9 @@
                             }
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "The mechanism is : " + authentication.getMechanism()
);
@@ -425,6 +430,9 @@
                             credentials.setCredentials( tlv.getValue().getData() );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "The credentials are : " + credentials.getCredentials()
);

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/bind/BindResponseGrammar.java
Fri Jan 13 02:00:32 2006
@@ -163,6 +163,9 @@
                             bindResponseMessage.setServerSaslCreds( tlv.getValue().getData()
);
                         }
                         
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "The SASL credentials value is : " + bindResponseMessage.getServerSaslCreds().toString()
);

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/compare/CompareRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/compare/CompareRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/compare/CompareRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/compare/CompareRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -34,7 +34,6 @@
 import org.apache.ldap.common.codec.LdapStatesEnum;
 import org.apache.ldap.common.codec.util.LdapString;
 import org.apache.ldap.common.codec.util.LdapStringEncodingException;
-//import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
@@ -298,7 +297,10 @@
                                 }
                             }
                         }
-                   }
+
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                    }
                 } );
     }
 

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/del/DelRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/del/DelRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/del/DelRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/del/DelRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -31,7 +31,6 @@
 import org.apache.ldap.common.codec.LdapMessage;
 import org.apache.ldap.common.codec.LdapMessageContainer;
 import org.apache.ldap.common.codec.LdapStatesEnum;
-//import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
@@ -131,6 +130,9 @@
 
                         // then we associate it to the ldapMessage Object
                         ldapMessage.setProtocolOP( delRequest );
+                        
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                         
                         if ( log.isDebugEnabled() )
                         {

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -133,9 +133,12 @@
                             extendedRequest.setRequestName( new OID( tlv.getValue().getData()
) );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "OID read : " + extendedRequest.getRequestName() );
+                            log.debug( "OID read : {}", extendedRequest.getRequestName()
);
                         }
                     }
                 } );
@@ -180,9 +183,12 @@
                             extendedRequest.setRequestValue(tlv.getValue().getData() );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Extended value : " + extendedRequest.getRequestValue()
);
+                            log.debug( "Extended value : {}", extendedRequest.getRequestValue()
);
                         }
                     }
                 } );

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedResponseGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedResponseGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/extended/ExtendedResponseGrammar.java
Fri Jan 13 02:00:32 2006
@@ -144,9 +144,12 @@
 			                    extendedResponse.setResponseName( new OID( tlv.getValue().getData()
) );
 			                }
                             
-                            if ( log.isDebugEnabled() )
+	                        // We can have an END transition
+	                        ldapMessageContainer.grammarEndAllowed( true );
+
+	                        if ( log.isDebugEnabled() )
                             {
-                                log.debug( "OID read : " + extendedResponse.getResponseName()
);
+                                log.debug( "OID read : {}", extendedResponse.getResponseName()
);
                             }
 			            }
 			        } );
@@ -191,9 +194,12 @@
                             extendedResponse.setResponse( tlv.getValue().getData() );
                         }
                         
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Extended value : " + extendedResponse.getResponse()
);
+                            log.debug( "Extended value : {}" + extendedResponse.getResponse()
);
                         }
                     }
                 } );

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modify/ModifyRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -481,6 +481,9 @@
 					        }
                         }
                         
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "Value modified : " + value );

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modifyDn/ModifyDNRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modifyDn/ModifyDNRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modifyDn/ModifyDNRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/modifyDn/ModifyDNRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -298,6 +298,9 @@
                             throw new DecoderException( bde.getMessage() );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             if ( modifyDNRequest.isDeleteOldRDN() )
@@ -388,6 +391,9 @@
                             modifyDNRequest.setNewSuperior( newSuperior );
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "New superior DN " + newSuperior );

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -163,10 +163,7 @@
                         
                         searchRequest.setBaseObject(baseObject);
 
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Searching with root DN : " + baseObject );
-                        }
+                        log.debug( "Searching with root DN : {}", baseObject );
                        
                         return;
                     }
@@ -218,7 +215,7 @@
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            log.error( "The scope is not in [0..2] : " + value.toString()
);
+                            log.error( "The scope is not in [0..2] : {}", value.toString()
);
                             throw new DecoderException( "The scope is not in [0..2] : " +
value.toString() );
                         }
                         
@@ -294,7 +291,7 @@
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            log.error( "The derefAlias is not in [0..3] : " + value.toString()
);
+                            log.error( "The derefAlias is not in [0..3] : {}", value.toString()
);
                             throw new DecoderException( "The derefAlias is not in [0..3]
: " + value.toString() );
                         }
                         
@@ -366,7 +363,7 @@
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            log.error( "The sizeLimit is not a valid Integer: " + value.toString()
);
+                            log.error( "The sizeLimit is not a valid Integer: {}", value.toString()
);
                             throw new DecoderException( "The sizeLimit is not a valid Integer:
" + value.toString() );
                         }
 
@@ -374,7 +371,7 @@
 
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "The sizeLimit value is set to " + sizeLimit + " objects"
);
+                            log.debug( "The sizeLimit value is set to {} objects", new Integer(
sizeLimit ) );
                         }
 
                         return;
@@ -423,7 +420,7 @@
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            log.error( "The timeLimit is not a valid Integer: " + value.toString()
);
+                            log.error( "The timeLimit is not a valid Integer: {}", value.toString()
);
                             throw new DecoderException( "The timeLimit is not a valid Integer:
" + value.toString() );
                         }
                         
@@ -431,7 +428,7 @@
 
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "The timeLimit value is set to " + timeLimit + " seconds"
);
+                            log.debug( "The timeLimit value is set to {} seconds", new Integer(
timeLimit ) );
                         }
 
                         return;
@@ -483,15 +480,16 @@
                         }
                         catch ( BooleanDecoderException bde )
                         {
-                            log.error("The types only flag " + StringTools.dumpBytes( value.getData()
) + 
-                                    " is invalid : " + bde.getMessage() + ". It should be
0 or 255" );
+                            log.error("The types only flag {} is invalid : {}. It should
be 0 or 255",
+                            		StringTools.dumpBytes( value.getData() ), 
+                                    bde.getMessage() );
                         
                             throw new DecoderException( bde.getMessage() );
                         }
 
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "The search will return " + ( searchRequest.isTypesOnly()
? 
+                            log.debug( "The search will return {}", ( searchRequest.isTypesOnly()
? 
                                         "only attributs type" : 
                                         "attributes types and values" ) );
                         }
@@ -671,6 +669,9 @@
                         	searchRequest.initAttributes();
                         }
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+
                         return;
                     }
                 } );
@@ -706,13 +707,16 @@
                         }
                         catch ( LdapStringEncodingException lsee )
                         {
-                            log.error( "Cannot decode the attribute description : " + StringTools.dumpBytes(
tlv.getValue().getData() ) );
+                            log.error( "Cannot decode the attribute description : {}", StringTools.dumpBytes(
tlv.getValue().getData() ) );
                             throw new DecoderException( "Cannot decode the attribute description"
);
                         }
                         
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Decoded Attribute Description : " + attributeDescription.getString()
);
+                            log.debug( "Decoded Attribute Description : {}", attributeDescription.getString()
);
                         }
 
                         return;

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultEntryGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultEntryGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultEntryGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultEntryGrammar.java
Fri Jan 13 02:00:32 2006
@@ -34,7 +34,6 @@
 import org.apache.ldap.common.codec.LdapStatesEnum;
 import org.apache.ldap.common.codec.util.LdapString;
 import org.apache.ldap.common.codec.util.LdapStringEncodingException;
-//import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
@@ -161,13 +160,13 @@
                             catch ( InvalidNameException ine )
                             {
                             	String msg = "The DN " + StringTools.dumpBytes( tlv.getValue().getData()
) + "is invalid : " + ine.getMessage(); 
-                                log.error( msg + " : " + ine.getMessage());
+                                log.error( "{} : {}", msg, ine.getMessage());
                                 throw new DecoderException( msg, ine );
                             }
                             catch ( NamingException ne )
                             {
                             	String msg = "The DN " + StringTools.dumpBytes( tlv.getValue().getData()
) + "is invalid : " + ne.getMessage();
-                                log.error( msg + " : " + ne.getMessage() );
+                                log.error( "{} : {}", msg, ne.getMessage() );
                                 throw new DecoderException( msg, ne );
                             }
 
@@ -176,7 +175,7 @@
 
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Search Result Entry DN found : " + searchResultEntry.getObjectName()
);
+                            log.debug( "Search Result Entry DN found : {}", searchResultEntry.getObjectName()
);
                         }
                     }
                 } );
@@ -239,6 +238,10 @@
                             ldapMessage.getSearchResultEntry();
 
                         searchResultEntry.addPartialAttributeList();
+
+                        // The length could be null, so
+                        // we can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                     }
                 } );
 
@@ -290,15 +293,12 @@
                             }
                             catch ( LdapStringEncodingException lsee )
                             {
-                                log.error( "Invalid attribute type : " + StringTools.dumpBytes(
tlv.getValue().getData() ) );
+                                log.error( "Invalid attribute type : {}", StringTools.dumpBytes(
tlv.getValue().getData() ) );
                                 throw new DecoderException( "The attribute type is invalid
: " + lsee.getMessage() );
                             }
                         }
                         
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Attribute type : " + type );
-                        }
+                        log.debug( "Attribute type : {}", type );
                     }
                 } );
 
@@ -367,6 +367,8 @@
                         if ( tlv.getLength().getLength() == 0 )
                         {
                             searchResultEntry.addAttributeValue( "" );
+
+                            log.debug( "The attribute value is null" );
                         }
                         else
                         {
@@ -376,21 +378,21 @@
                                 
                                 if ( log.isDebugEnabled() )
                                 {
-                                    log.debug( "Attribute value " + StringTools.dumpBytes(
(byte[])value ) );
+                                    log.debug( "Attribute value {}", StringTools.dumpBytes(
(byte[])value ) );
                                 }
                             }
                             else
                             {
                                 value = StringTools.utf8ToString( tlv.getValue().getData()
);
 
-                                if ( log.isDebugEnabled() )
-                                {
-                                    log.debug( "Attribute value " + value );
-                                }
+                                log.debug( "Attribute value {}", value );
                             }
 
                             searchResultEntry.addAttributeValue( value );
                         }
+
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                     }
                 } );
 

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultReferenceGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultReferenceGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultReferenceGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/SearchResultReferenceGrammar.java
Fri Jan 13 02:00:32 2006
@@ -143,15 +143,15 @@
                             catch ( LdapURLEncodingException luee )
                             {
                                 String badUrl = new String( tlv.getValue().getData() );
-                                log.error( "The URL " + badUrl + " is not valid : " + luee.getMessage()
);
+                                log.error( "The URL {} is not valid : {}", badUrl, luee.getMessage()
);
                                 throw new DecoderException( "Invalid URL : " + luee.getMessage()
);
                             }
                         }
                         
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Search reference URL found : " + url );
-                        }
+                        log.debug( "Search reference URL found : {}", url );
+                        
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
                         
                         return;
                     }

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/EntryChangeControlGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/EntryChangeControlGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/EntryChangeControlGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/EntryChangeControlGrammar.java
Fri Jan 13 02:00:32 2006
@@ -145,6 +145,9 @@
 	                		log.error( msg );
 	                    	throw new DecoderException( msg );
                 	}
+
+                    // We can have an END transition
+                    entryChangeContainer.grammarEndAllowed( true );
                 }
                 catch ( IntegerDecoderException e )
                 {
@@ -219,6 +222,9 @@
 	                }
 	                
 	                entryChangeContainer.getEntryChangeControl().setPreviousDn( previousDn );
+
+	                // We can have an END transition
+                    entryChangeContainer.grammarEndAllowed( true );
                 }
             }
         };
@@ -282,6 +288,9 @@
                     }
                     
                     entryChangeContainer.getEntryChangeControl().setChangeNumber( changeNumber
);
+
+                    // We can have an END transition
+                    entryChangeContainer.grammarEndAllowed( true );
                 }
                 catch ( IntegerDecoderException e )
                 {

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
Fri Jan 13 02:00:32 2006
@@ -34,6 +34,7 @@
 {
     private final static String CONTROL_TYPE_OID = "2.16.840.1.113730.3.4.3";
     
+    private static final Asn1Decoder decoder = new Asn1Decoder();
     
     public String getControlType()
     {
@@ -43,9 +44,6 @@
 
     public Asn1Object decode(byte[] controlBytes) throws DecoderException
     {
-        // @todo if Asn1Decoder is reusable and thread safe the we should reuse it
-        // instead of creating a new one every time.
-        Asn1Decoder decoder = new Asn1Decoder();
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         PSearchControlContainer container = new PSearchControlContainer();
         decoder.decode( bb, container );

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlGrammar.java
Fri Jan 13 02:00:32 2006
@@ -171,6 +171,9 @@
                             }
                             
                             psearchContainer.getPSearchControl().setReturnECs( returnECs
);
+
+                            // We can have an END transition
+                            psearchContainer.grammarEndAllowed( true );
                         }
                         catch ( BooleanDecoderException e )
                         {

Modified: directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/unbind/UnBindRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/unbind/UnBindRequestGrammar.java?rev=368663&r1=368662&r2=368663&view=diff
==============================================================================
--- directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/unbind/UnBindRequestGrammar.java
(original)
+++ directory/trunks/ldap-common/src/main/java/org/apache/ldap/common/codec/unbind/UnBindRequestGrammar.java
Fri Jan 13 02:00:32 2006
@@ -116,6 +116,9 @@
 
                         unBindRequest.setParent( ldapMessage );
 
+                        // We can have an END transition
+                        ldapMessageContainer.grammarEndAllowed( true );
+                        
                         // And we associate it to the ldapMessage Object
                         ldapMessage.setProtocolOP( unBindRequest );
                     }



Mime
View raw message