directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1442292 - in /directory: apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/ apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ shared/trunk/ldap/client/api/...
Date Mon, 04 Feb 2013 18:28:46 GMT
Author: elecharny
Date: Mon Feb  4 18:28:45 2013
New Revision: 1442292

URL: http://svn.apache.org/viewvc?rev=1442292&view=rev
Log:
o Added some checks in the LdapNetworkConnection API for async operations so that we don't
get NPE

Modified:
    directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ModifyRequestImpl.java

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1442292&r1=1442291&r2=1442292&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Mon Feb  4 18:28:45 2013
@@ -376,7 +376,8 @@ public class AciAuthorizationInterceptor
         {
             Dn parentDn = dn.getParent();
             CoreSession session = opContext.getSession();
-            LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn,
SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn,
+                SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
             originalEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         }
@@ -1442,8 +1443,8 @@ public class AciAuthorizationInterceptor
 
             return filter( searchContext, normName, entry );
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java?rev=1442292&r1=1442291&r2=1442292&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
Mon Feb  4 18:28:45 2013
@@ -70,7 +70,7 @@ public class ClientModifyDnRequestTest e
     @Before
     public void setup() throws Exception
     {
-        connection = (LdapNetworkConnection)LdapApiIntegrationUtils.getPooledAdminConnection(
getLdapServer() );
+        connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection(
getLdapServer() );
         session = getLdapServer().getDirectoryService().getAdminSession();
     }
 

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1442292&r1=1442291&r2=1442292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Mon Feb  4 18:28:45 2013
@@ -1549,6 +1549,13 @@ public class LdapNetworkConnection exten
             throw new IllegalArgumentException( msg );
         }
 
+        if ( searchRequest.getBase() == null )
+        {
+            String msg = "Cannot process a searchRequest which base DN is null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
         // If the session has not been establish, or is closed, we get out immediately
         checkSession();
 
@@ -2217,6 +2224,13 @@ public class LdapNetworkConnection exten
             throw new IllegalArgumentException( msg );
         }
 
+        if ( modRequest.getName() == null )
+        {
+            String msg = "Cannot process a modifyRequest which DN is null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
         checkSession();
 
         int newId = messageId.incrementAndGet();
@@ -2326,7 +2340,7 @@ public class LdapNetworkConnection exten
 
         if ( newSuperiorDn == null )
         {
-            String msg = "Cannot process a move to a null Dn";
+            String msg = "Cannot process a move to a null newSuperior";
             LOG.debug( msg );
             throw new IllegalArgumentException( msg );
         }
@@ -2357,7 +2371,7 @@ public class LdapNetworkConnection exten
 
         if ( newSuperiorDn == null )
         {
-            String msg = "Cannot process a move to a null Dn";
+            String msg = "Cannot process a move to a null newSuperior";
             LOG.debug( msg );
             throw new IllegalArgumentException( msg );
         }
@@ -2522,6 +2536,20 @@ public class LdapNetworkConnection exten
             throw new IllegalArgumentException( msg );
         }
 
+        if ( modDnRequest.getName() == null )
+        {
+            String msg = "Cannot process a modifyRequest which DN is null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
+        if ( ( modDnRequest.getNewSuperior() == null ) && ( modDnRequest.getNewRdn()
== null ) )
+        {
+            String msg = "Cannot process a modifyRequest which new superior and new Rdn are
null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
         checkSession();
 
         int newId = messageId.incrementAndGet();
@@ -2711,6 +2739,13 @@ public class LdapNetworkConnection exten
             throw new IllegalArgumentException( msg );
         }
 
+        if ( deleteRequest.getName() == null )
+        {
+            String msg = "Cannot process a deleteRequest which DN is null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
         checkSession();
 
         int newId = messageId.incrementAndGet();
@@ -2892,6 +2927,13 @@ public class LdapNetworkConnection exten
             throw new IllegalArgumentException( msg );
         }
 
+        if ( compareRequest.getName() == null )
+        {
+            String msg = "Cannot process a compareRequest which DN is null";
+            LOG.debug( msg );
+            throw new IllegalArgumentException( msg );
+        }
+
         checkSession();
 
         int newId = messageId.incrementAndGet();

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ModifyRequestImpl.java?rev=1442292&r1=1442291&r2=1442292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ModifyRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ModifyRequestImpl.java
Mon Feb  4 18:28:45 2013
@@ -48,7 +48,7 @@ public class ModifyRequestImpl extends A
     /** Dn of the entry to modify or PDU's <b>object</b> field */
     private Dn name;
 
-    /** Sequence of modifications or PDU's <b>modification</b> seqence field
*/
+    /** Sequence of modifications or PDU's <b>modification</b> sequence field
*/
     private List<Modification> mods = new ArrayList<Modification>();
 
     /** The associated response */
@@ -406,7 +406,7 @@ public class ModifyRequestImpl extends A
             }
             else
 
-            if ( !item.equals( ( DefaultModification ) mods.get( i ) ) )
+            if ( !item.equals( mods.get( i ) ) )
             {
                 return false;
             }



Mime
View raw message