directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r433711 - in /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap: codec/ResponseCarryingException.java codec/del/DelRequestGrammar.java message/ResponseCarryingMessageException.java
Date Tue, 22 Aug 2006 18:02:10 GMT
Author: elecharny
Date: Tue Aug 22 11:02:09 2006
New Revision: 433711

URL: http://svn.apache.org/viewvc?rev=433711&view=rev
Log:
The encoder need a Message, not a LdapMessage. The code was changed accordingly

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

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java?rev=433711&r1=433710&r2=433711&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
Tue Aug 22 11:02:09 2006
@@ -17,6 +17,7 @@
 package org.apache.directory.shared.ldap.codec;
 
 import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.message.Message;
 
 
 /**
@@ -37,7 +38,7 @@
     private static final long serialVersionUID = 1L;
 
     /** The response with the error cause */
-    private LdapMessage response;
+    private Message response;
     
     /**
      * Creates a DecoderException
@@ -68,7 +69,7 @@
      * Set a response if we get an exception while parsing the message
      * @param response the constructed response
      */
-    public void setResponse( LdapMessage response ) 
+    public void setResponse( Message response ) 
     {
         this.response = response;
     }
@@ -77,7 +78,7 @@
      * Get the constructed response
      * @return The constructed response
      */
-    public LdapMessage getResponse()
+    public Message getResponse()
     {
         return response;
     }

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=433711&r1=433710&r2=433711&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 11:02:09 2006
@@ -29,12 +29,10 @@
 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.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 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;
@@ -119,35 +117,18 @@
                         }
                         catch ( InvalidNameException ine )
                         {
-                            String msg = "The DN to delete  (" + StringTools.dumpBytes( tlv.getValue().getData()
)
+                            String msg = "The DN to delete :" + StringTools.utf8ToString(
tlv.getValue().getData() )+ " (" + StringTools.dumpBytes( tlv.getValue().getData() )
                                 + ") is invalid";
                             log.error( "{} : {}", msg, ine.getMessage() );
                             
-                            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 );
+                            DeleteResponseImpl message = new DeleteResponseImpl( delRequest.getMessageId()
);
+                            message.getLdapResult().setErrorMessage( "abc" );
+                            message.getLdapResult().setResultCode( ResultCodeEnum.INVALIDDNSYNTAX
);
+                            message.getLdapResult().setMatchedDn( LdapDN.EMPTY_LDAPDN );
                             
                             ResponseCarryingException exception = new ResponseCarryingException(
msg, ine );
                             
-                            exception.setResponse( response );
+                            exception.setResponse( message );
                             
                             throw exception;
                         }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java?rev=433711&r1=433710&r2=433711&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java
Tue Aug 22 11:02:09 2006
@@ -28,7 +28,6 @@
 
 
 import org.apache.directory.shared.ldap.RuntimeMultiException;
-import org.apache.directory.shared.ldap.codec.LdapMessage;
 
 
 /**
@@ -48,7 +47,7 @@
     private static final long serialVersionUID = 1L;
 
     /** The response with the error cause */
-    private LdapMessage response;
+    private Message response;
     
     /**
      * Constructs an Exception without a message.
@@ -74,7 +73,7 @@
      * Set a response if we get an exception while parsing the message
      * @param response the constructed response
      */
-    public void setResponse( LdapMessage response ) 
+    public void setResponse( Message response ) 
     {
         this.response = response;
     }
@@ -83,7 +82,7 @@
      * Get the constructed response
      * @return The constructed response
      */
-    public LdapMessage getResponse()
+    public Message getResponse()
     {
         return response;
     }



Mime
View raw message