directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r947248 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/entry/ core-api/src/main/java/org/apache/directory/server/core/filtering/ core-api/src/main/java/org/apache/directory/server/core/schema/registr...
Date Sat, 22 May 2010 06:06:04 GMT
Author: felixk
Date: Sat May 22 06:06:03 2010
New Revision: 947248

URL: http://svn.apache.org/viewvc?rev=947248&view=rev
Log:
Combine nested if statements

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
    directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/htree/HashDirectory.java
    directory/apacheds/trunk/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
    directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
    directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
Sat May 22 06:06:03 2010
@@ -104,13 +104,10 @@ public class ServerEntryUtils
             EntryAttribute attr = entry.get( attributeType );
             
             // Deal with a special case : an entry without any ObjectClass
-            if ( attributeType.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+            if ( attributeType.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) &&
attr.size() == 0 )
             {
-                if ( attr.size() == 0 )
-                {
-                    // We don't have any objectClass, just dismiss this element
-                    continue;
-                }
+                // We don't have any objectClass, just dismiss this element
+                continue;
             }
             
             attributes.put( toBasicAttribute( attr ) );

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
Sat May 22 06:06:03 2010
@@ -527,14 +527,11 @@ public class BaseEntryFilteringCursor im
                 return true;
             }
             
-            if ( filters.size() == 1 )
+            if ( filters.size() == 1 &&  filters.get( 0 ).accept( getOperationContext(),
tempResult ) )
             {
-                if ( filters.get( 0 ).accept( getOperationContext(), tempResult ) )
-                {
-                    prefetched = tempResult;
-                    filterContents( prefetched );
-                    return true;
-                }
+                prefetched = tempResult;
+                filterContents( prefetched );
+                return true;
             }
             
             /* E N D   O P T I M I Z A T I O N */
@@ -597,14 +594,11 @@ public class BaseEntryFilteringCursor im
                 return true;
             }
             
-            if ( filters.size() == 1 )
+            if ( filters.size() == 1 && filters.get( 0 ).accept( getOperationContext(),
tempResult ) )
             {
-                if ( filters.get( 0 ).accept( getOperationContext(), tempResult ) )
-                {
-                    prefetched = tempResult;
-                    filterContents( prefetched );
-                    return true;
-                }
+                prefetched = tempResult;
+                filterContents( prefetched );
+                return true;
             }
             
             /* E N D   O P T I M I Z A T I O N */

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
Sat May 22 06:06:03 2010
@@ -402,12 +402,9 @@ public class SchemaSynchronizer implemen
              * we check that the value is "TRUE" and disable that schema if so.
              */
             case ADD_ATTRIBUTE :
-                if ( disabledInEntry == null )
+                if ( disabledInEntry == null && "TRUE".equalsIgnoreCase( disabledInMods.getString()
) )
                 {
-                    if ( "TRUE".equalsIgnoreCase( disabledInMods.getString() ) )
-                    {
-                        return disableSchema( getSchemaName( name ) );
-                    }
+                    return disableSchema( getSchemaName( name ) );
                 }
                 
                 break;

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
Sat May 22 06:06:03 2010
@@ -328,12 +328,9 @@ public class AvlTreeImpl<K> implements A
         {
             int balFactor = getBalance( node );
 
-            if( node != root )
+            if( node != root && treePath.indexOf( node ) < ( size - 1 ) )
             {
-                if( treePath.indexOf( node ) < ( size - 1 ) )
-                {
-                    parentNode = treePath.get( treePath.indexOf( node ) + 1 );
-                }
+                parentNode = treePath.get( treePath.indexOf( node ) + 1 );
             }
 
             if( balFactor > 1 )
@@ -569,12 +566,9 @@ public class AvlTreeImpl<K> implements A
          when the 'parentNode' param is null then the node under rotation is a child of ROOT.
          Most likely this condition executes when the root node is deleted and balancing
is required.
          */
-        else if( root != null )
+        else if( root != null && root.left == node )
         {
-            if( root.left == node )
-            {
-                root.left = temp;
-            }
+            root.left = temp;
             // no need to check for right node
         }
     }

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
Sat May 22 06:06:03 2010
@@ -492,12 +492,9 @@ public class AvlTreeMapImpl<K,V> impleme
         {
             int balFactor = getBalance( node );
 
-            if( node != root )
+            if( node != root && treePath.indexOf( node ) < ( size - 1 ) )
             {
-                if( treePath.indexOf( node ) < ( size - 1 ) )
-                {
-                    parentNode = treePath.get( treePath.indexOf( node ) + 1 );
-                }
+                parentNode = treePath.get( treePath.indexOf( node ) + 1 );
             }
 
             if( balFactor > 1 )
@@ -720,12 +717,9 @@ public class AvlTreeMapImpl<K,V> impleme
          when the 'parentNode' param is null then the node under rotation is a child of ROOT.
          Most likely this condition executes when the root node is deleted and balancing
is required.
          */
-        else if( root != null )
+        else if( root != null && root.left == node )
         {
-            if( root.left == node )
-            {
-                root.left = temp;
-            }
+            root.left = temp;
             // no need to check for right node
         }
     }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Sat May 22 06:06:03 2010
@@ -458,13 +458,11 @@ public abstract class ServerContext impl
         responseControls = JndiUtils.toJndiControls( opCtx.getResponseControls() );
 
         // Now remove the ObjectClass attribute if it has not been requested
-        if ( ( opCtx.getAttrsId() != null ) && ( opCtx.getAttrsId().size() != 0 )
)
+        if ( ( opCtx.getAttrsId() != null ) && ( opCtx.getAttrsId().size() != 0 )
&&
+            ( ( serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ) != null )
+                && ( serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ).size() ==
0 ) ) )
         {
-            if ( ( serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ) != null )
-                && ( serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ).size() ==
0 ) )
-            {
-                serverEntry.removeAttributes( SchemaConstants.OBJECT_CLASS_AT );
-            }
+            serverEntry.removeAttributes( SchemaConstants.OBJECT_CLASS_AT );
         }
 
         return serverEntry;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Sat May 22 06:06:03 2010
@@ -539,6 +539,8 @@ public class AciAuthorizationInterceptor
     }
 
 
+    // False positive, we want to keep the comment
+    @SuppressWarnings("PMD.CollapsibleIfStatements")
     public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         DN name = opContext.getDn();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
Sat May 22 06:06:03 2010
@@ -190,23 +190,20 @@ public class DefaultAuthorizationInterce
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( dn.size() > 2 )
+        if ( dn.size() > 2 && !isAnAdministrator( principalDN ) )
         {
-            if ( !isAnAdministrator( principalDN ) )
+            if ( dn.isChildOf( ADMIN_SYSTEM_DN ) )
             {
-                if ( dn.isChildOf( ADMIN_SYSTEM_DN ) )
-                {
-                    String msg = I18n.err( I18n.ERR_15, principalDN.getName(), dn.getName()
);
-                    LOG.error( msg );
-                    throw new LdapNoPermissionException( msg );
-                }
+                String msg = I18n.err( I18n.ERR_15, principalDN.getName(), dn.getName() );
+                LOG.error( msg );
+                throw new LdapNoPermissionException( msg );
+            }
         
-                if ( dn.isChildOf( GROUP_BASE_DN ) )
-                {
-                    String msg = I18n.err( I18n.ERR_16, principalDN.getName(), dn.getName()
);
-                    LOG.error( msg );
-                    throw new LdapNoPermissionException( msg );
-                }
+            if ( dn.isChildOf( GROUP_BASE_DN ) )
+            {
+                String msg = I18n.err( I18n.ERR_16, principalDN.getName(), dn.getName() );
+                LOG.error( msg );
+                throw new LdapNoPermissionException( msg );
             }
         }
 
@@ -493,6 +490,8 @@ public class DefaultAuthorizationInterce
     }
 
 
+    // False positive, we want to keep the comment
+    @SuppressWarnings("PMD.CollapsibleIfStatements")
     private boolean isSearchable( OperationContext opContext, ClonedServerEntry result )
throws Exception
     {
         DN principalDn = opContext.getSession().getEffectivePrincipal().getDN();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
Sat May 22 06:06:03 2010
@@ -306,12 +306,9 @@ public class EventInterceptor extends Ba
             DN base = criteria.getBase();
 
             // fix for DIRSERVER-1502
-            if( name.equals( base ) || name.isChildOf( base ) )
+            if( name.equals( base ) || name.isChildOf( base ) && evaluator.evaluate(
criteria.getFilter(), base, entry ) )
             {
-                if ( evaluator.evaluate( criteria.getFilter(), base, entry ) )
-                {
-                    selecting.add( registration );
-                }
+                selecting.add( registration );
             }
         }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
Sat May 22 06:06:03 2010
@@ -505,13 +505,11 @@ public class ExceptionInterceptor extend
         {
             EntryFilteringCursor cursor =  nextInterceptor.search( opContext );
             
-            if ( ! cursor.next() )
+            if ( ! cursor.next() && !base.isEmpty() && !( subschemSubentryDn.getNormName()
).equalsIgnoreCase( 
+                base.getNormName() ) )
             {
-                if ( !base.isEmpty() && !( subschemSubentryDn.getNormName() ).equalsIgnoreCase(
base.getNormName() ) )
-                {
-                    // We just check that the entry exists only if we didn't found any entry
-                    assertHasEntry( opContext, "Attempt to search under non-existant entry:"
, base );
-                }
+                // We just check that the entry exists only if we didn't found any entry
+                assertHasEntry( opContext, "Attempt to search under non-existant entry:"
, base );
             }
 
             return cursor;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Sat May 22 06:06:03 2010
@@ -457,13 +457,10 @@ public class SchemaInterceptor extends B
                     String oid = schemaManager.getAttributeTypeRegistry().getOidByName( attribute
);
 
                     // The attribute must be an AttributeType
-                    if ( schemaManager.getAttributeTypeRegistry().contains( oid ) )
+                    if ( schemaManager.getAttributeTypeRegistry().contains( oid ) &&
!filteredAttrs.containsKey( oid ) )
                     {
-                        if ( !filteredAttrs.containsKey( oid ) )
-                        {
-                            // Ok, we can add the attribute to the list of filtered attributes
-                            filteredAttrs.put( oid, attribute );
-                        }
+                        // Ok, we can add the attribute to the list of filtered attributes
+                        filteredAttrs.put( oid, attribute );
                     }
                 }
 
@@ -1062,15 +1059,12 @@ public class SchemaInterceptor extends B
             AttributeType attributeType = attribute.getAttributeType();
             
             // We don't allow modification of operational attributes
-            if ( !attributeType.isUserModifiable() )
+            if ( !attributeType.isUserModifiable() && ( !attributeType.equals( MODIFIERS_NAME_ATTRIBUTE_TYPE
) &&
+                     !attributeType.equals( MODIFY_TIMESTAMP_ATTRIBUTE_TYPE ) ) )
             {
-                if ( !attributeType.equals( MODIFIERS_NAME_ATTRIBUTE_TYPE ) &&
-                     !attributeType.equals( MODIFY_TIMESTAMP_ATTRIBUTE_TYPE ) )
-                {
-                    String msg = I18n.err( I18n.ERR_52, attributeType );
-                    LOG.error( msg );
-                    throw new LdapNoPermissionException( msg );
-                }
+                String msg = I18n.err( I18n.ERR_52, attributeType );
+                LOG.error( msg );
+                throw new LdapNoPermissionException( msg );
             }
             
             switch ( mod.getOperation() )
@@ -1614,13 +1608,11 @@ public class SchemaInterceptor extends B
 
             AttributeType attributeType = attribute.getAttributeType();
 
-            if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS
) )
+            if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS
) &&
+                !allowed.contains( attrOid ) )
             {
-                if ( !allowed.contains( attrOid ) )
-                {
-                    throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION,
I18n.err( I18n.ERR_277, attribute.getUpId(),
-                            dn.getName() ) );
-                }
+                throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION,
I18n.err( I18n.ERR_277, attribute.getUpId(),
+                        dn.getName() ) );
             }
         }
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
Sat May 22 06:06:03 2010
@@ -138,20 +138,15 @@ public class SubtreeEvaluator
          * entries with a baseRelativeRdn size less than the minimum distance
          * are rejected.
          */
-        if ( subtree.getMaxBaseDistance() != SubtreeSpecification.UNBOUNDED_MAX )
+        if ( subtree.getMaxBaseDistance() != SubtreeSpecification.UNBOUNDED_MAX &&
+            subtree.getMaxBaseDistance() < baseRelativeRdn.size() )
         {
-            if ( subtree.getMaxBaseDistance() < baseRelativeRdn.size() )
-            {
-                return false;
-            }
+            return false;
         }
 
-        if ( subtree.getMinBaseDistance() > 0 )
+        if ( subtree.getMinBaseDistance() > 0 && baseRelativeRdn.size() < subtree.getMinBaseDistance()
)
         {
-            if ( baseRelativeRdn.size() < subtree.getMinBaseDistance() )
-            {
-                return false;
-            }
+            return false;
         }
 
         /*

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
Sat May 22 06:06:03 2010
@@ -289,12 +289,9 @@ public class PasswordPolicyInterceptor e
 
         for ( int ii = 0; ii < tokens.length; ii++ )
         {
-            if ( tokens[ii].length() >= tokenSize )
+            if ( tokens[ii].length() >= tokenSize && password.matches( "(?i).*"
+ tokens[ii] + ".*" ) )
             {
-                if ( password.matches( "(?i).*" + tokens[ii] + ".*" ) )
-                {
-                    return false;
-                }
+                return false;
             }
         }
 

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Sat May 22 06:06:03 2010
@@ -768,30 +768,27 @@ public class JdbmTable<K,V> implements T
             // if the number of duplicates falls below the numDupLimit value
             BTree tree = getBTree( values.getBTreeRedirect() );
             
-            if ( tree.find( value ) != null )
+            if ( tree.find( value ) != null && tree.remove( value ) != null )
             {
-                if ( tree.remove( value ) != null )
+                /*
+                 * If we drop below the duplicate limit then we revert from using
+                 * a Jdbm BTree to using an in memory AvlTree.
+                 */
+                if ( tree.size() <= numDupLimit )
                 {
-                    /*
-                     * If we drop below the duplicate limit then we revert from using
-                     * a Jdbm BTree to using an in memory AvlTree.
-                     */
-                    if ( tree.size() <= numDupLimit )
-                    {
-                        ArrayTree<V> avlTree = convertToArrayTree( tree );
-                        bt.insert( key, (V)marshaller.serialize( avlTree ), true );
-                        recMan.delete( tree.getRecordId() );
-                    }
-                    
-                    count--;
-                    
-                    if ( LOG.isDebugEnabled() )
-                    {
-                        LOG.debug( "<--- Remove BTREE " + name + " = " + key + ", " +
value );
-                    }
+                    ArrayTree<V> avlTree = convertToArrayTree( tree );
+                    bt.insert( key, (V)marshaller.serialize( avlTree ), true );
+                    recMan.delete( tree.getRecordId() );
+                }
                     
-                    return;
+                count--;
+                  
+                if ( LOG.isDebugEnabled() )
+                {
+                    LOG.debug( "<--- Remove BTREE " + name + " = " + key + ", " + value
);
                 }
+                    
+                return;
             }
         }
         catch ( Exception e )

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
Sat May 22 06:06:03 2010
@@ -186,13 +186,10 @@ class NoDupsCursor<K,V> extends Abstract
 
         if ( browser.getPrevious( jdbmTuple ) )
         {
-            if( returnedTuple.getKey() != null )
+            if( returnedTuple.getKey() != null && table.getKeyComparator().compare(
+                ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
             {
-                if( table.getKeyComparator().compare(
-                    ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
-                {
-                    browser.getPrevious( jdbmTuple );
-                }
+                browser.getPrevious( jdbmTuple );
             }
 
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
@@ -218,13 +215,10 @@ class NoDupsCursor<K,V> extends Abstract
 
         if ( browser.getNext( jdbmTuple ) )
         {
-            if( returnedTuple.getKey() != null )
+            if( returnedTuple.getKey() != null && table.getKeyComparator().compare(
+                ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
             {
-                if( table.getKeyComparator().compare(
-                    ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
-                {
-                    browser.getNext( jdbmTuple );
-                }
+                browser.getNext( jdbmTuple );
             }
             
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/htree/HashDirectory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/htree/HashDirectory.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/htree/HashDirectory.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/htree/HashDirectory.java Sat May 22 06:06:03
2010
@@ -307,13 +307,11 @@ final class HashDirectory
                 HashDirectory dir = (HashDirectory)node;
                 dir.setPersistenceContext( _recman, child_recid );
                 Object existing = dir.remove(key);
-                if (existing != null) {
-                    if (dir.isEmpty()) {
-                        // delete empty directory
-                        _recman.delete(child_recid);
-                        _children[hash] = 0;
-                        _recman.update(_recid, this);
-                    }
+                if (existing != null && dir.isEmpty()) {
+                    // delete empty directory
+                    _recman.delete(child_recid);
+                    _children[hash] = 0;
+                    _recman.update(_recid, this);
                 }
                 return existing;
             } else {

Modified: directory/apacheds/trunk/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
(original)
+++ directory/apacheds/trunk/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
Sat May 22 06:06:03 2010
@@ -167,12 +167,9 @@ public class CheckPasswordPolicy impleme
 
         for ( int ii = 0; ii < tokens.length; ii++ )
         {
-            if ( tokens[ii].length() >= tokenSize )
+            if ( tokens[ii].length() >= tokenSize && password.matches( "(?i).*"
+ tokens[ii] + ".*" ) )
             {
-                if ( password.matches( "(?i).*" + tokens[ii] + ".*" ) )
-                {
-                    return false;
-                }
+                return false;
             }
         }
 

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
(original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
Sat May 22 06:06:03 2010
@@ -144,13 +144,11 @@ public class Subnet extends DhcpConfigEl
         for ( int i = 0; i < masked.length; i++ )
             masked[i] &= client[i];
 
-        if ( null != rangeMin )
-            if ( arrayComp( masked, rangeMin.getAddress() ) < 0 )
-                return false;
-
-        if ( null != rangeMin )
-            if ( arrayComp( masked, rangeMax.getAddress() ) > 0 )
-                return false;
+        if ( null != rangeMin && arrayComp( masked, rangeMin.getAddress() ) <
0 )
+            return false;
+
+        if ( null != rangeMin && arrayComp( masked, rangeMax.getAddress() ) >
0 )
+            return false;
 
         return true;
     }

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
(original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
Sat May 22 06:06:03 2010
@@ -694,37 +694,34 @@ public class AuthenticationService
     {
         Object reply = kdcContext.getReply();
 
-        if ( LOG.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() && reply instanceof KdcReply )
         {
-            if ( reply instanceof KdcReply )
+            KdcReply success = ( KdcReply ) reply;
+
+            try
             {
-                KdcReply success = ( KdcReply ) reply;
+                StringBuffer sb = new StringBuffer();
+
+                sb.append( "Responding with " + SERVICE_NAME + " reply:" );
+                sb.append( "\n\t" + "messageType:           " + success.getMessageType()
);
+                sb.append( "\n\t" + "protocolVersionNumber: " + success.getProtocolVersionNumber()
);
+                sb.append( "\n\t" + "nonce:                 " + success.getNonce() );
+                sb.append( "\n\t" + "clientPrincipal:       " + success.getClientPrincipal()
);
+                sb.append( "\n\t" + "client realm:          " + success.getClientRealm()
);
+                sb.append( "\n\t" + "serverPrincipal:       " + success.getServerPrincipal()
);
+                sb.append( "\n\t" + "server realm:          " + success.getServerRealm()
);
+                sb.append( "\n\t" + "auth time:             " + success.getAuthTime() );
+                sb.append( "\n\t" + "start time:            " + success.getStartTime() );
+                sb.append( "\n\t" + "end time:              " + success.getEndTime() );
+                sb.append( "\n\t" + "renew-till time:       " + success.getRenewTill() );
+                sb.append( "\n\t" + "hostAddresses:         " + success.getClientAddresses()
);
 
-                try
-                {
-                    StringBuffer sb = new StringBuffer();
-
-                    sb.append( "Responding with " + SERVICE_NAME + " reply:" );
-                    sb.append( "\n\t" + "messageType:           " + success.getMessageType()
);
-                    sb.append( "\n\t" + "protocolVersionNumber: " + success.getProtocolVersionNumber()
);
-                    sb.append( "\n\t" + "nonce:                 " + success.getNonce() );
-                    sb.append( "\n\t" + "clientPrincipal:       " + success.getClientPrincipal()
);
-                    sb.append( "\n\t" + "client realm:          " + success.getClientRealm()
);
-                    sb.append( "\n\t" + "serverPrincipal:       " + success.getServerPrincipal()
);
-                    sb.append( "\n\t" + "server realm:          " + success.getServerRealm()
);
-                    sb.append( "\n\t" + "auth time:             " + success.getAuthTime()
);
-                    sb.append( "\n\t" + "start time:            " + success.getStartTime()
);
-                    sb.append( "\n\t" + "end time:              " + success.getEndTime()
);
-                    sb.append( "\n\t" + "renew-till time:       " + success.getRenewTill()
);
-                    sb.append( "\n\t" + "hostAddresses:         " + success.getClientAddresses()
);
-
-                    LOG.debug( sb.toString() );
-                }
-                catch ( Exception e )
-                {
-                    // This is a monitor.  No exceptions should bubble up.
-                    LOG.error( I18n.err( I18n.ERR_155 ), e );
-                }
+                LOG.debug( sb.toString() );
+            }
+            catch ( Exception e )
+            {
+                // This is a monitor.  No exceptions should bubble up.
+                LOG.error( I18n.err( I18n.ERR_155 ), e );
             }
         }
     }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
Sat May 22 06:06:03 2010
@@ -121,6 +121,8 @@ public abstract class LdapRequestHandler
     /**
      *{@inheritDoc} 
      */
+    // False positive, we want to keep the comment
+    @SuppressWarnings("PMD.CollapsibleIfStatements")
     public final void handleMessage( IoSession session, T message ) throws Exception
     {
         LdapSession ldapSession = ldapServer.getLdapSessionManager().getLdapSession( session
);

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
Sat May 22 06:06:03 2010
@@ -73,6 +73,8 @@ public class SearchTimeLimitingMonitor i
      * (non-Javadoc)
      * @see org.apache.directory.server.core.cursor.ClosureMonitor#checkNotClosed()
      */
+    // False positive, we want to keep the comment
+    @SuppressWarnings("PMD.CollapsibleIfStatements")
     public void checkNotClosed() throws Exception
     {
         if ( System.currentTimeMillis() > startTime + millisToLive )

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
Sat May 22 06:06:03 2010
@@ -646,12 +646,9 @@ public class SyncReplConsumer implements
             return;
         }
 
-        if ( lastSavedCookie != null )
+        if ( lastSavedCookie != null && Arrays.equals( syncCookie, lastSavedCookie
) )
         {
-            if ( Arrays.equals( syncCookie, lastSavedCookie ) )
-            {
-                return;
-            }
+            return;
         }
 
         try

Modified: directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=947248&r1=947247&r2=947248&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(original)
+++ directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Sat May 22 06:06:03 2010
@@ -237,12 +237,9 @@ public class FrameworkRunner extends Blo
             // Now run the class
             super.run( notifier );
 
-            if ( classLdapServer != null )
+            if ( classLdapServer != null && ( ( suite == null ) || ( suite.getLdapServer()
!= classLdapServer ) ) )
             {
-                if ( ( suite == null ) || ( suite.getLdapServer() != classLdapServer ) )
-                {
-                    classLdapServer.stop();
-                }
+                classLdapServer.stop();
             }
 
             if ( classKdcServer != null )



Mime
View raw message