directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r963813 - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Date Tue, 13 Jul 2010 18:46:01 GMT
Author: kayyagari
Date: Tue Jul 13 18:46:00 2010
New Revision: 963813

URL: http://svn.apache.org/viewvc?rev=963813&view=rev
Log:
o updated the methods to prevent losing controls added the the OperationContext in the case
of a LdapException while performing the
  actual operation
  (this is required in the case of ppolicy implementation where a PwdPolicyResponseControl
is added even when the operation throws a policy related exception)

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

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=963813&r1=963812&r2=963813&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
Tue Jul 13 18:46:00 2010
@@ -179,7 +179,15 @@ public class DefaultCoreSession implemen
         addContext.setLogChange( log );
         
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.add( addContext );
+        try
+        {
+            operationManager.add( addContext );
+        }
+        catch( LdapException e )
+        {
+            addRequest.getResultResponse().addAll( addContext.getResponseControls() );
+            throw e;
+        }
         addRequest.getResultResponse().addAll( addContext.getResponseControls() );
     }
 
@@ -788,7 +796,17 @@ public class DefaultCoreSession implemen
     {
         CompareOperationContext compareContext = new CompareOperationContext( this, compareRequest
);
         OperationManager operationManager = directoryService.getOperationManager();
-        boolean result = operationManager.compare( compareContext );
+        boolean result = false;
+        try
+        {
+            result = operationManager.compare( compareContext );
+        }
+        catch( LdapException e )
+        {
+            compareRequest.getResultResponse().addAll( compareContext.getResponseControls()
);
+            throw e;
+        }
+        
         compareRequest.getResultResponse().addAll( compareContext.getResponseControls() );
         return result;
     }
@@ -813,7 +831,16 @@ public class DefaultCoreSession implemen
         deleteContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.delete( deleteContext );
+        try
+        {
+            operationManager.delete( deleteContext );
+        }
+        catch( LdapException e )
+        {
+            deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls()
);
+            throw e;
+        }
+        
         deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls() );
     }
 
@@ -845,7 +872,17 @@ public class DefaultCoreSession implemen
         modifyContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.modify( modifyContext );
+        
+        try
+        {
+            operationManager.modify( modifyContext );
+        }
+        catch( LdapException e )
+        {
+            modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls()
);
+            throw e;
+        }
+        
         modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls() );
     }
 
@@ -869,7 +906,17 @@ public class DefaultCoreSession implemen
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.move( moveContext );
+        
+        try
+        {
+            operationManager.move( moveContext );
+        }
+        catch( LdapException e )
+        {
+            modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls()
);
+            throw e;
+        }
+        
         modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls() );
     }
 
@@ -893,7 +940,17 @@ public class DefaultCoreSession implemen
         moveAndRenameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.moveAndRename( moveAndRenameContext );
+        
+        try
+        {
+            operationManager.moveAndRename( moveAndRenameContext );
+        }
+        catch( LdapException e )
+        {
+            modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls()
);
+            throw e;
+        }
+        
         modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls()
);
     }
 
@@ -917,7 +974,17 @@ public class DefaultCoreSession implemen
         renameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.rename( renameContext );
+        
+        try
+        {
+            operationManager.rename( renameContext );
+        }
+        catch( LdapException e )
+        {
+            modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls()
);
+            throw e;
+        }
+        
         modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls() );
     }
 
@@ -926,7 +993,19 @@ public class DefaultCoreSession implemen
     {
         SearchOperationContext searchContext = new SearchOperationContext( this, searchRequest
);
         OperationManager operationManager = directoryService.getOperationManager();
-        EntryFilteringCursor cursor = operationManager.search( searchContext );
+        
+        EntryFilteringCursor cursor = null;
+        
+        try
+        {
+            cursor = operationManager.search( searchContext );
+        }
+        catch( LdapException e )
+        {
+            searchRequest.getResultResponse().addAll( searchContext.getResponseControls()
);
+            throw e;
+        }
+        
         searchRequest.getResultResponse().addAll( searchContext.getResponseControls() );
         
         return cursor;

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=963813&r1=963812&r2=963813&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Tue Jul 13 18:46:00 2010
@@ -188,6 +188,7 @@ public class BindHandler extends LdapReq
             }
             
             // Return the successful response
+            bindRequest.getResultResponse().addAll( bindContext.getResponseControls() );

             sendBindSuccess( ldapSession, bindRequest, null );
         }
         catch ( Exception e )
@@ -237,6 +238,7 @@ public class BindHandler extends LdapReq
             }
 
             result.setErrorMessage( msg );
+            bindRequest.getResultResponse().addAll( bindContext.getResponseControls() );
             ldapSession.getIoSession().write( bindRequest.getResultResponse() );
         }
     }



Mime
View raw message