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/11/23 14:20:05 UTC
svn commit: r348430 -
/directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java
Author: elecharny
Date: Wed Nov 23 05:19:55 2005
New Revision: 348430
URL: http://svn.apache.org/viewcvs?rev=348430&view=rev
Log:
Fixed the grammar to handle a String instead of an OID for the control type
Modified:
directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java
Modified: directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java?rev=348430&r1=348429&r2=348430&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java (original)
+++ directory/shared/ldap/trunk/apache2-provider/src/main/java/org/apache/asn1new/ldap/codec/grammar/LdapControlGrammar.java Wed Nov 23 05:19:55 2005
@@ -28,9 +28,10 @@
import org.apache.asn1new.util.BooleanDecoder;
import org.apache.asn1new.util.BooleanDecoderException;
import org.apache.asn1.codec.util.StringUtils;
-import org.apache.asn1new.primitives.OID;
import org.apache.asn1new.ldap.codec.LdapConstants;
import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.codec.primitives.LdapString;
+import org.apache.asn1new.ldap.codec.primitives.LdapStringEncodingException;
import org.apache.asn1new.ldap.pojo.Control;
import org.apache.asn1new.ldap.pojo.LdapMessage;
import org.slf4j.Logger;
@@ -184,12 +185,24 @@
// We have to handle the special case of a 0 length OID
if ( tlv.getLength().getLength() == 0 )
{
- log.error( "The name must not be null" );
- throw new DecoderException( "The name must not be null" );
+ log.error( "The OID must not be null" );
+ throw new DecoderException( "The OID must not be null" );
}
else
{
- control.setControlType( new OID( tlv.getValue().getData() ) );
+ // The OID is encoded as a String, not an Object Id
+ try
+ {
+ control.setControlType( new LdapString( tlv.getValue().getData() ) );
+ }
+ catch ( LdapStringEncodingException lsee )
+ {
+ log.error("The control type " + StringUtils.dumpBytes( tlv.getValue().getData() ) +
+ " is invalid : " + lsee.getMessage() );
+
+ throw new DecoderException( lsee.getMessage() );
+
+ }
}
if ( log.isDebugEnabled() )