directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1028226 - /directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Date Thu, 28 Oct 2010 08:50:10 GMT
Author: pamarcelot
Date: Thu Oct 28 08:50:09 2010
New Revision: 1028226

URL: http://svn.apache.org/viewvc?rev=1028226&view=rev
Log:
Better handling of the delete operation for a non leaf entry (now throwing the expected 'ContextNotEmptyException'
which is handled by the DeleteRunnable class correctly)

Modified:
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1028226&r1=1028225&r2=1028226&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Thu Oct 28 08:50:09 2010
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.List;
 
 import javax.naming.CommunicationException;
+import javax.naming.ContextNotEmptyException;
 import javax.naming.InsufficientResourcesException;
 import javax.naming.NamingException;
 import javax.naming.ServiceUnavailableException;
@@ -1062,9 +1063,19 @@ public class DirectoryApiConnectionWrapp
         if ( response != null )
         {
             LdapResult ldapResult = response.getLdapResult();
-            if ( ( ldapResult != null ) && !( ResultCodeEnum.SUCCESS.equals( ldapResult.getResultCode()
) ) )
+            if ( ldapResult != null )
             {
-                throw new Exception( ldapResult.getResultCode().getResultCode() + " " + ldapResult.getErrorMessage()
);
+                // NOT_ALLOWED_ON_NON_LEAF error (thrown when deleting a entry with children
+                if ( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF.equals( ldapResult.getResultCode()
) )
+                {
+                    throw new ContextNotEmptyException( ldapResult.getErrorMessage() );
+                }
+                // Different from SUCCESS, we throw a generic exception
+                else if ( !ResultCodeEnum.SUCCESS.equals( ldapResult.getResultCode() ) )
+                {
+                    throw new Exception( ldapResult.getResultCode().getResultCode() + " "
+                        + ldapResult.getErrorMessage() );
+                }
             }
         }
     }



Mime
View raw message