directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r437695 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestGrammar.java
Date Mon, 28 Aug 2006 13:10:30 GMT
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
                     {



Mime
View raw message