directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r437713 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java
Date Mon, 28 Aug 2006 14:06:56 GMT
Author: elecharny
Date: Mon Aug 28 07:06:55 2006
New Revision: 437713

URL: http://svn.apache.org/viewvc?rev=437713&view=rev
Log:
Fixed the throwed exceptions to fix DIRSERVER-711

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java?rev=437713&r1=437712&r2=437713&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestGrammar.java
Mon Aug 28 07:06:55 2006
@@ -21,6 +21,7 @@
 
 
 import javax.naming.InvalidNameException;
+import javax.naming.NamingException;
 
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
@@ -37,6 +38,7 @@
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.util.LdapString;
 import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -139,6 +141,7 @@
                     // DN
                     if ( tlv.getLength().getLength() == 0 )
                     {
+                        // This will generate a PROTOCOL_ERROR
                         throw new DecoderException( "The entry must not be null" );
                     }
                     else
@@ -202,7 +205,7 @@
             LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_VALUE, LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_TAG,
             new GrammarAction( "Store attribute desc" )
             {
-                public void action( IAsn1Container container ) throws DecoderException
+                public void action( IAsn1Container container ) throws DecoderException, NamingException
                 {
 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
container;
@@ -218,7 +221,11 @@
                     // DN
                     if ( tlv.getLength().getLength() == 0 )
                     {
-                        throw new DecoderException( "The attribute description must not be
null" );
+                        String msg = "The attribute description must not be null";
+                        log.error( msg );
+                        CompareResponseImpl response = new CompareResponseImpl( ldapMessage.getMessageId()
);
+                        
+                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDATTRIBUTESYNTAX,
compareRequest.getEntry(), null );
                     }
                     else
                     {
@@ -231,9 +238,7 @@
                         {
                             log.error( "The attribute description ({}) is invalid.", StringTools.dumpBytes(
tlv
                                 .getValue().getData() ) );
-                            throw new DecoderException( "Invalid attribute description "
-                                + StringTools.dumpBytes( tlv.getValue().getData() ) + ",
: " + lsee.getMessage() );
-
+                            throw new LdapInvalidAttributeIdentifierException( "Invalid attribute
type : " + lsee.getMessage() );
                         }
                     }
 



Mime
View raw message