directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r433799 - in /directory/trunks: apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ apacheds/server-unit/src/test/java/org/apache/directory/server/ shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ shared/...
Date Tue, 22 Aug 2006 23:35:14 GMT
Author: elecharny
Date: Tue Aug 22 16:35:13 2006
New Revision: 433799

URL: http://svn.apache.org/viewvc?rev=433799&view=rev
Log:
Fixed DIRSERVER-634 and merged the classes from 1.0-trunks to 1.1 trunks

Added:
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DelITest.java
      - copied unchanged from r433781, directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/DelITest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
      - copied unchanged from r433781, directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java
      - copied unchanged from r433779, directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/ResponseCarryingMessageException.java
Modified:
    directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java?rev=433799&r1=433798&r2=433799&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
(original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
Tue Aug 22 16:35:13 2006
@@ -65,6 +65,7 @@
 import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
 import org.apache.directory.shared.ldap.message.Request;
+import org.apache.directory.shared.ldap.message.ResponseCarryingMessageException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.ResultResponse;
 import org.apache.directory.shared.ldap.message.ResultResponseRequest;
@@ -402,6 +403,13 @@
 
         public void exceptionCaught( IoSession session, Throwable cause )
         {
+            if ( cause.getCause() instanceof ResponseCarryingMessageException )
+            {
+                ResponseCarryingMessageException rcme = ( ResponseCarryingMessageException
) cause.getCause();
+                session.write( rcme.getResponse() );
+                return;
+            }
+            
             SessionLog.warn( session,
                 "Unexpected exception forcing session to close: sending disconnect notice
to client.", cause );
             session.write( NoticeOfDisconnect.PROTOCOLERROR );

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java?rev=433799&r1=433798&r2=433799&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequestGrammar.java
Tue Aug 22 16:35:13 2006
@@ -29,13 +29,15 @@
 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.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.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
@@ -115,10 +117,20 @@
                         }
                         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() );
-                            throw new DecoderException( msg, ine );
+                            
+                            DeleteResponseImpl message = new DeleteResponseImpl( ldapMessage.getMessageId()
);
+                            message.getLdapResult().setErrorMessage( "abc" );
+                            message.getLdapResult().setResultCode( ResultCodeEnum.INVALIDDNSYNTAX
);
+                            message.getLdapResult().setMatchedDn( LdapDN.EMPTY_LDAPDN );
+                            
+                            ResponseCarryingException exception = new ResponseCarryingException(
msg, ine );
+                            
+                            exception.setResponse( message );
+                            
+                            throw exception;
                         }
                         delRequest.setEntry( entry );
                     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=433799&r1=433798&r2=433799&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
Tue Aug 22 16:35:13 2006
@@ -28,6 +28,7 @@
 import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderMonitor;
 import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder;
+import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.ProviderDecoder;
 import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
@@ -167,21 +168,28 @@
     {
         Object providerEnvelope;
 
-        if ( lock == null )
-        {
-            // Complain here somehow first then do the following w/o synch!
-
-            // Call provider decoder to demarshall PDU into berlib specific form
-            providerEnvelope = decoder.decode( lock, in );
-        }
-        else
+        try
         {
-            synchronized ( lock )
+            if ( lock == null )
             {
-                // Same as above but a synchronized read using valid lock object
+                // Complain here somehow first then do the following w/o synch!
+    
+                // Call provider decoder to demarshall PDU into berlib specific form
                 providerEnvelope = decoder.decode( lock, in );
-                lock.notifyAll();
             }
+            else
+            {
+                synchronized ( lock )
+                {
+                    // Same as above but a synchronized read using valid lock object
+                    providerEnvelope = decoder.decode( lock, in );
+                    lock.notifyAll();
+                }
+            }
+        }
+        catch (Exception e) 
+        {
+            throw (MessageException)e;
         }
 
         // Call on transformer to convert stub based PDU into Message based PDU
@@ -207,7 +215,18 @@
         }
         catch ( DecoderException e )
         {
-            throw new MessageException( "decoder failture: " + e.getMessage() );
+            // transform the DecoderException message to a MessageException
+            if ( e instanceof ResponseCarryingException ) 
+            {
+                ResponseCarryingMessageException rcme = new ResponseCarryingMessageException(
e.getMessage() );
+                rcme.setResponse( ((ResponseCarryingException)e).getResponse() );
+                
+                throw rcme;
+            }
+            else
+            {
+                throw new MessageException( "decoder failture: " + e.getMessage() );
+            }
         }
     }
 



Mime
View raw message