directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r946122 - in /directory/shared/trunk: ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/ ldap/src/main/java/org/apache/directory/shared/ldap/message/ ldap/src/main/java/org/apache/directory/shared/ldap/me...
Date Wed, 19 May 2010 10:58:57 GMT
Author: felixk
Date: Wed May 19 10:58:57 2010
New Revision: 946122

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

Modified:
    directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ParserDescriptionUtils.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java

Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
Wed May 19 10:58:57 2010
@@ -125,13 +125,10 @@ public class DefaultSchemaLdifExtractor 
      */
     public void extractOrCopy( boolean overwrite ) throws IOException
     {
-        if ( !outputDirectory.exists() )
+        if ( !outputDirectory.exists() && !outputDirectory.mkdirs() )
         {
-            if ( !outputDirectory.mkdirs() )
-            {
-                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
outputDirectory
-                    .getAbsolutePath() ) );
-            }
+            throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED, outputDirectory
+                .getAbsolutePath() ) );
         }
 
         File schemaDirectory = new File( outputDirectory, SCHEMA_SUBDIR );
@@ -192,13 +189,10 @@ public class DefaultSchemaLdifExtractor 
     {
         LOG.debug( "copyFile(): source = {}, destination = {}", source, destination );
 
-        if ( !destination.getParentFile().exists() )
+        if ( !destination.getParentFile().exists() && !destination.getParentFile().mkdirs()
)
         {
-            if ( !destination.getParentFile().mkdirs() )
-            {
-                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
destination.getParentFile()
-                    .getAbsolutePath() ) );
-            }
+            throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED, destination.getParentFile()
+                .getAbsolutePath() ) );
         }
 
         if ( !source.getParentFile().exists() )
@@ -409,13 +403,10 @@ public class DefaultSchemaLdifExtractor 
                 return;
             }
 
-            if ( !destination.getParentFile().exists() )
+            if ( !destination.getParentFile().exists() && !destination.getParentFile().mkdirs()
)
             {
-                if ( !destination.getParentFile().mkdirs() )
-                {
-                    throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
destination
-                        .getParentFile().getAbsolutePath() ) );
-                }
+                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
destination
+                    .getParentFile().getAbsolutePath() ) );
             }
 
             FileOutputStream out = new FileOutputStream( destination );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
Wed May 19 10:58:57 2010
@@ -172,12 +172,9 @@ public class ExtendedResponseImpl extend
             return false;
         }
 
-        if ( oid != null && resp.getResponseName() != null )
+        if ( oid != null && resp.getResponseName() != null && !oid.equals(
resp.getResponseName() ) )
         {
-            if ( !oid.equals( resp.getResponseName() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( value != null && resp.getResponse() == null )
@@ -190,12 +187,9 @@ public class ExtendedResponseImpl extend
             return false;
         }
 
-        if ( value != null && resp.getResponse() != null )
+        if ( value != null && resp.getResponse() != null && !Arrays.equals(
value, resp.getResponse() ) )
         {
-            if ( !Arrays.equals( value, resp.getResponse() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         return true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
Wed May 19 10:58:57 2010
@@ -149,12 +149,10 @@ public class IntermediateResponseImpl ex
             return false;
         }
 
-        if ( ( oid != null ) && ( resp.getResponseName() != null ) )
+        if ( ( oid != null ) && ( resp.getResponseName() != null ) && !oid.equals(

+            resp.getResponseName() ) )
         {
-            if ( !oid.equals( resp.getResponseName() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( ( value != null ) && ( resp.getResponseValue() == null ) )
@@ -167,12 +165,10 @@ public class IntermediateResponseImpl ex
             return false;
         }
 
-        if ( ( value != null ) && ( resp.getResponseValue() != null ) )
+        if ( ( value != null ) && ( resp.getResponseValue() != null ) &&
!Arrays.equals( value,
+            resp.getResponseValue() ) )
         {
-            if ( !Arrays.equals( value, resp.getResponseValue() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         return true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
Wed May 19 10:58:57 2010
@@ -206,12 +206,9 @@ public class LdapResultImpl implements I
             return false;
         }
 
-        if ( referral != null && result.getReferral() != null )
+        if ( referral != null && result.getReferral() != null && !referral.equals(
result.getReferral() ) )
         {
-            if ( !referral.equals( result.getReferral() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( !resultCode.equals( result.getResultCode() ) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
Wed May 19 10:58:57 2010
@@ -263,12 +263,9 @@ public class ModifyDnRequestImpl extends
             return false;
         }
 
-        if ( name != null && req.getName() != null )
+        if ( name != null && req.getName() != null && !name.equals( req.getName()
) )
         {
-            if ( !name.equals( req.getName() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( deleteOldRdn != req.getDeleteOldRdn() )
@@ -286,12 +283,9 @@ public class ModifyDnRequestImpl extends
             return false;
         }
 
-        if ( newRdn != null && req.getNewRdn() != null )
+        if ( newRdn != null && req.getNewRdn() != null && !newRdn.equals(
req.getNewRdn() ) )
         {
-            if ( !newRdn.equals( req.getNewRdn() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( newSuperior != null && req.getNewSuperior() == null )
@@ -304,12 +298,9 @@ public class ModifyDnRequestImpl extends
             return false;
         }
 
-        if ( newSuperior != null && req.getNewSuperior() != null )
+        if ( newSuperior != null && req.getNewSuperior() != null && !newSuperior.equals(
req.getNewSuperior() ) )
         {
-            if ( !newSuperior.equals( req.getNewSuperior() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         return true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
Wed May 19 10:58:57 2010
@@ -204,12 +204,9 @@ public class ModifyRequestImpl extends A
             return false;
         }
 
-        if ( name != null && req.getName() != null )
+        if ( name != null && req.getName() != null && !name.equals( req.getName()
) )
         {
-            if ( !name.equals( req.getName() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( req.getModificationItems().size() != mods.size() )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
Wed May 19 10:58:57 2010
@@ -410,20 +410,14 @@ public class SearchRequestImpl extends A
             return false;
         }
 
-        if ( req.getAttributes() == null && attributes != null )
+        if ( req.getAttributes() == null && attributes != null && attributes.size()
> 0 )
         {
-            if ( attributes.size() > 0 )
-            {
-                return false;
-            }
+            return false;
         }
 
-        if ( req.getAttributes() != null && attributes == null )
+        if ( req.getAttributes() != null && attributes == null && req.getAttributes().size()
> 0 )
         {
-            if ( req.getAttributes().size() > 0 )
-            {
-                return false;
-            }
+            return false;
         }
 
         if ( req.getAttributes() != null && attributes != null )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImpl.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImpl.java
Wed May 19 10:58:57 2010
@@ -113,12 +113,9 @@ public class SearchResponseReferenceImpl
             return false;
         }
 
-        if ( this.referral != null && resp.getReferral() != null )
+        if ( this.referral != null && resp.getReferral() != null && !this.referral.equals(
resp.getReferral() ) )
         {
-            if ( !this.referral.equals( resp.getReferral() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         return true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
Wed May 19 10:58:57 2010
@@ -110,12 +110,9 @@ public abstract class InternalAbstractRe
             return false;
         }
 
-        if ( getLdapResult() != null && resp.getLdapResult() != null )
+        if ( getLdapResult() != null && resp.getLdapResult() != null && !getLdapResult().equals(
resp.getLdapResult() ) )
         {
-            if ( !getLdapResult().equals( resp.getLdapResult() ) )
-            {
-                return false;
-            }
+            return false;
         }
 
         return true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
Wed May 19 10:58:57 2010
@@ -561,13 +561,10 @@ public class AttributeType extends Abstr
      */
     private void checkCollective( List<Throwable> errors, Registries registries )
     {
-        if ( superior != null )
+        if ( superior != null && superior.isCollective() )
         {
-            if ( superior.isCollective() )
-            {
-                // An AttributeType will be collective if its superior is collective
-                this.isCollective = true;
-            }
+            // An AttributeType will be collective if its superior is collective
+            this.isCollective = true;
         }
 
         if ( isCollective() && ( usage != UsageEnum.USER_APPLICATIONS ) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
Wed May 19 10:58:57 2010
@@ -207,13 +207,10 @@ public class DITContentRule extends Abst
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !auxObjectClassOids.contains( objectClass.getOid() )
)
         {
-            if ( !auxObjectClassOids.contains( objectClass.getOid() ) )
-            {
-                auxObjectClasses.add( objectClass );
-                auxObjectClassOids.add( objectClass.getOid() );
-            }
+            auxObjectClasses.add( objectClass );
+            auxObjectClassOids.add( objectClass.getOid() );
         }
     }
 
@@ -309,13 +306,10 @@ public class DITContentRule extends Abst
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !mayAttributeTypeOids.contains( attributeType.getOid()
) )
         {
-            if ( !mayAttributeTypeOids.contains( attributeType.getOid() ) )
-            {
-                mayAttributeTypes.add( attributeType );
-                mayAttributeTypeOids.add( attributeType.getOid() );
-            }
+            mayAttributeTypes.add( attributeType );
+            mayAttributeTypeOids.add( attributeType.getOid() );
         }
     }
 
@@ -413,13 +407,10 @@ public class DITContentRule extends Abst
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !mustAttributeTypeOids.contains( attributeType.getOid()
) )
         {
-            if ( !mustAttributeTypeOids.contains( attributeType.getOid() ) )
-            {
-                mustAttributeTypes.add( attributeType );
-                mustAttributeTypeOids.add( attributeType.getOid() );
-            }
+            mustAttributeTypes.add( attributeType );
+            mustAttributeTypeOids.add( attributeType.getOid() );
         }
     }
 
@@ -517,13 +508,10 @@ public class DITContentRule extends Abst
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !notAttributeTypeOids.contains( attributeType.getOid()
) )
         {
-            if ( !notAttributeTypeOids.contains( attributeType.getOid() ) )
-            {
-                notAttributeTypes.add( attributeType );
-                notAttributeTypeOids.add( attributeType.getOid() );
-            }
+            notAttributeTypes.add( attributeType );
+            notAttributeTypeOids.add( attributeType.getOid() );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
Wed May 19 10:58:57 2010
@@ -247,6 +247,7 @@ public class LdapSyntax extends Abstract
      * @param registries The Registries
      * @exception If the Syntx is not valid 
      */
+    @SuppressWarnings("PMD.CollapsibleIfStatements") // Used because of comments
     public void removeFromRegistries( List<Throwable> errors, Registries registries
) throws LdapException
     {
         if ( registries != null )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
Wed May 19 10:58:57 2010
@@ -217,12 +217,9 @@ public class MatchingRuleUse extends Abs
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !applicableAttributeOids.contains( oid ) )
         {
-            if ( !applicableAttributeOids.contains( oid ) )
-            {
-                applicableAttributeOids.add( oid );
-            }
+            applicableAttributeOids.add( oid );
         }
     }
 
@@ -239,13 +236,10 @@ public class MatchingRuleUse extends Abs
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !applicableAttributeOids.contains( attributeType.getOid()
) )
         {
-            if ( !applicableAttributeOids.contains( attributeType.getOid() ) )
-            {
-                applicableAttributes.add( attributeType );
-                applicableAttributeOids.add( attributeType.getOid() );
-            }
+            applicableAttributes.add( attributeType );
+            applicableAttributeOids.add( attributeType.getOid() );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
Wed May 19 10:58:57 2010
@@ -342,13 +342,10 @@ public class NameForm extends AbstractSc
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !mustAttributeTypeOids.contains( attributeType.getOid()
) )
         {
-            if ( !mustAttributeTypeOids.contains( attributeType.getOid() ) )
-            {
-                mustAttributeTypes.add( attributeType );
-                mustAttributeTypeOids.add( attributeType.getOid() );
-            }
+            mustAttributeTypes.add( attributeType );
+            mustAttributeTypeOids.add( attributeType.getOid() );
         }
     }
 
@@ -457,13 +454,10 @@ public class NameForm extends AbstractSc
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
         
-        if ( !isReadOnly )
+        if ( !isReadOnly && !mayAttributeTypeOids.contains( attributeType.getOid()
) )
         {
-            if ( !mayAttributeTypeOids.contains( attributeType.getOid() ) )
-            {
-                mayAttributeTypes.add( attributeType );
-                mayAttributeTypeOids.add( attributeType.getOid() );
-            }
+            mayAttributeTypes.add( attributeType );
+            mayAttributeTypeOids.add( attributeType.getOid() );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ParserDescriptionUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ParserDescriptionUtils.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ParserDescriptionUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ParserDescriptionUtils.java
Wed May 19 10:58:57 2010
@@ -234,12 +234,9 @@ public class ParserDescriptionUtils
         }
         
         // check that the obsolete flag is equal but not for syntaxes
-        if ( ( so0 instanceof LdapSyntax ) || ( so1 instanceof LdapSyntax ) )
+        if ( ( ( so0 instanceof LdapSyntax ) || ( so1 instanceof LdapSyntax ) ) &&
so0.isObsolete() != so1.isObsolete() )
         {
-            if ( so0.isObsolete() != so1.isObsolete() )
-            {
-                return false;
-            }
+            return false;
         }
         
         // check that the description matches

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
Wed May 19 10:58:57 2010
@@ -73,13 +73,10 @@ public abstract class AbstractSchemaLoad
             listener.schemaLoaded( schema );
         }
 
-        if ( registries instanceof SchemaLoaderListener )
+        if ( registries instanceof SchemaLoaderListener && registries != listener
)
         {
-            if ( registries != listener )
-            {
-                SchemaLoaderListener listener = ( SchemaLoaderListener ) registries;
-                listener.schemaLoaded( schema );
-            }
+            SchemaLoaderListener listener = ( SchemaLoaderListener ) registries;
+            listener.schemaLoaded( schema );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Wed May 19 10:58:57 2010
@@ -357,12 +357,9 @@ public class AttributeUtils
                 {
                     Object value = values.nextElement();
     
-                    if ( value instanceof byte[] )
+                    if ( value instanceof byte[] && ArrayUtils.isEquals( comparedBytes,
value ) )
                     {
-                        if ( ArrayUtils.isEquals( comparedBytes, value ) )
-                        {
-                            return true;
-                        }
+                        return true;
                     }
                 }
             }
@@ -405,12 +402,9 @@ public class AttributeUtils
                 {
                     Object attrVal = attrVals.nextElement();
 
-                    if ( attrVal instanceof String )
+                    if ( attrVal instanceof String &&  strVal.equalsIgnoreCase( (
String ) attrVal ) )
                     {
-                        if ( strVal.equalsIgnoreCase( ( String ) attrVal ) )
-                        {
-                            return true;
-                        }
+                        return true;
                     }
                 }
             }
@@ -424,13 +418,9 @@ public class AttributeUtils
                 {
                     Object attrVal = attrVals.nextElement();
 
-                    if ( attrVal instanceof byte[] )
+                    if ( attrVal instanceof byte[]  &&  Arrays.equals( ( byte[] )
attrVal, valueBytes ) )
                     {
-                        if ( Arrays.equals( ( byte[] ) attrVal, valueBytes ) )
-                        {
-                            return true;
-                        }
-
+                        return true;
                     }
                 }
             }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
Wed May 19 10:58:57 2010
@@ -363,6 +363,7 @@ public class LdapURL
      *         apply to the byte buffer TODO check that the topLabel is valid
      *         (it must start with an alpha)
      */
+    @SuppressWarnings("PMD.CollapsibleIfStatements") // Used because of comments
     private int parseHost( char[] chars, int pos )
     {
 
@@ -400,17 +401,13 @@ public class LdapURL
                 }
 
                 // Let's check the string we had before the dot.
-                if ( isHostNumber )
+                if ( isHostNumber &&  nbDots < 4 )
                 {
 
-                    if ( nbDots < 4 )
+                    // We had only digits. It may be an IP adress? Check it
+                    if ( ipElem[nbDots] > 65535 )
                     {
-
-                        // We had only digits. It may be an IP adress? Check it
-                        if ( ipElem[nbDots] > 65535 )
-                        {
-                            invalidIp = true;
-                        }
+                        invalidIp = true;
                     }
                 }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=946122&r1=946121&r2=946122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
Wed May 19 10:58:57 2010
@@ -497,12 +497,9 @@ public class StringTools
             ch = buf[i];
 
             // filter out all uppercase characters
-            if ( toLowerCase )
+            if ( toLowerCase && Character.isUpperCase( ch ) )
             {
-                if ( Character.isUpperCase( ch ) )
-                {
-                    ch = Character.toLowerCase( ch );
-                }
+                ch = Character.toLowerCase( ch );
             }
 
             // Check to see if we should add space
@@ -887,6 +884,7 @@ public class StringTools
      * @return the filter accepted path component Strings in the order
      *         encountered
      */
+    @SuppressWarnings("PMD.CollapsibleIfStatements") // Used because of comments
     public static final List<String> getPaths( String paths, FileFilter filter )
     {
         int start = 0;



Mime
View raw message