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 2006/08/28 15:10:30 UTC

svn commit: r437695 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java

Author: elecharny
Date: Mon Aug 28 06:10:30 2006
New Revision: 437695

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

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java?rev=437695&r1=437694&r2=437695&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java Mon Aug 28 06:10:30 2006
@@ -112,6 +112,8 @@
                     {
                         String msg = "The AddRequest must not be null";
                         log.error( msg );
+                        
+                        // Will generate a PROTOCOL_ERROR
                         throw new DecoderException( msg );
                     }
 
@@ -148,7 +150,14 @@
                     // Store the entry. It can't be null
                     if ( tlv.getLength().getLength() == 0 )
                     {
-                        throw new DecoderException( "The DN can't be null" );
+                        String msg = "Empty entry DN given";
+                        log.error( msg );
+                
+                        AddResponseImpl response = new AddResponseImpl( ldapMessage.getMessageId() );
+                
+                        // I guess that trying to add an entry which DN is empty is a naming violation...
+                        // Not 100% sure though ...
+                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.NAMINGVIOLATION, LdapDN.EMPTY_LDAPDN, null );
                     }
                     else
                     {
@@ -253,8 +262,12 @@
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
-                        log.error( "Null types are not allowed" );
-                        throw new DecoderException( "The type can't be null" );
+                        String msg = "Null or empty types are not allowed"; 
+                        log.error( msg );
+
+                        AddResponseImpl response = new AddResponseImpl( ldapMessage.getMessageId() );
+                        
+                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDATTRIBUTESYNTAX, addRequest.getEntry(), null );
                     }
                     else
                     {