directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r433692 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
Date Tue, 22 Aug 2006 17:03:41 GMT
Author: elecharny
Date: Tue Aug 22 10:03:40 2006
New Revision: 433692

URL: http://svn.apache.org/viewvc?rev=433692&view=rev
Log:
Created a Response when we have an exception while parsing a DN

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java?rev=433692&r1=433691&r2=433692&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
Tue Aug 22 10:03:40 2006
@@ -29,13 +29,17 @@
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.LdapStatesEnum;
+import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
+import org.apache.directory.shared.ldap.codec.util.LdapResultEnum;
+import org.apache.directory.shared.ldap.codec.util.LdapString;
+import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * This class implements the DelRequest LDAP message. All the actions are
  * declared in this class. As it is a singleton, these declaration are only done
@@ -118,7 +122,34 @@
                             String msg = "The DN to delete  (" + StringTools.dumpBytes( tlv.getValue().getData()
)
                                 + ") is invalid";
                             log.error( "{} : {}", msg, ine.getMessage() );
-                            throw new DecoderException( msg, ine );
+                            
+                            LdapResult ldapResult = new LdapResult();
+                            
+                            try 
+                            {
+                                ldapResult.setErrorMessage( new LdapString( StringTools.getBytesUtf8(
msg ) ) );
+                            }
+                            catch ( LdapStringEncodingException uee )
+                            {
+                                ldapResult.setErrorMessage( LdapString.EMPTY_STRING );
+                            }
+                            
+                            ldapResult.setResultCode( LdapResultEnum.INVALID_DN_SYNTAX );
+                            ldapResult.setMatchedDN( LdapDN.EMPTY_LDAPDN );
+                            
+                            DelResponse delResponse = new DelResponse();
+                            delResponse.setMessageId( delRequest.getMessageId() );
+                            delResponse.setLdapResult( ldapResult );
+                            
+                            LdapMessage response = new LdapMessage();
+                            response.setMessageId( delRequest.getMessageId() );
+                            response.setProtocolOP( delResponse );
+                            
+                            ResponseCarryingException exception = new ResponseCarryingException(
msg, ine );
+                            
+                            exception.setResponse( response );
+                            
+                            throw exception;
                         }
                         delRequest.setEntry( entry );
                     }



Mime
View raw message