You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/10/17 00:11:49 UTC

svn commit: r1023383 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java

Author: kayyagari
Date: Sat Oct 16 22:11:49 2010
New Revision: 1023383

URL: http://svn.apache.org/viewvc?rev=1023383&view=rev
Log:
o fixed the synrepl search to handle the exceptions properly
o moved the common code to handleException() method

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1023383&r1=1023382&r2=1023383&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Sat Oct 16 22:11:49 2010
@@ -1043,23 +1043,6 @@ public class SearchHandler extends LdapR
         }
         catch ( Exception e )
         {
-            /*
-             * From RFC 2251 Section 4.11:
-             *
-             * In the event that a server receives an Abandon Request on a Search
-             * operation in the midst of transmitting responses to the Search, that
-             * server MUST cease transmitting entry responses to the abandoned
-             * request immediately, and MUST NOT send the SearchResultDone. Of
-             * course, the server MUST ensure that only properly encoded LDAPMessage
-             * PDUs are transmitted.
-             *
-             * SO DON'T SEND BACK ANYTHING!!!!!
-             */
-            if ( e instanceof OperationAbandonedException )
-            {
-                return;
-            }
-
             // If it was a persistent search and if we had an exception,
             // we set the flag to remove the request from the session
             if ( isPersistentSearch )
@@ -1531,6 +1514,23 @@ public class SearchHandler extends LdapR
      */
     public void handleException( LdapSession session, ResultResponseRequest req, Exception e )
     {
+        /*
+         * From RFC 2251 Section 4.11:
+         *
+         * In the event that a server receives an Abandon Request on a Search
+         * operation in the midst of transmitting responses to the Search, that
+         * server MUST cease transmitting entry responses to the abandoned
+         * request immediately, and MUST NOT send the SearchResultDone. Of
+         * course, the server MUST ensure that only properly encoded LDAPMessage
+         * PDUs are transmitted.
+         *
+         * SO DON'T SEND BACK ANYTHING!!!!!
+         */
+        if ( e instanceof OperationAbandonedException )
+        {
+            return;
+        }
+
         LdapResult result = req.getResultResponse().getLdapResult();
 
         /*
@@ -1664,7 +1664,15 @@ public class SearchHandler extends LdapR
      */
     public void handleSyncreplSearch( LdapSession session, SearchRequest req ) throws LdapException
     {
-        replicationProvider.handleSyncRequest( session, req );
+        try
+        {
+            replicationProvider.handleSyncRequest( session, req );
+        }
+        catch( Exception e )
+        {
+            session.unregisterOutstandingRequest( req );
+            handleException( session, req, e );
+        }
     }
 
 }