directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r923666 - /directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
Date Tue, 16 Mar 2010 10:21:13 GMT
Author: elecharny
Date: Tue Mar 16 10:21:13 2010
New Revision: 923666

URL: http://svn.apache.org/viewvc?rev=923666&view=rev
Log:
Removed some useless contains() check.

Modified:
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java?rev=923666&r1=923665&r2=923666&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
(original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
Tue Mar 16 10:21:13 2010
@@ -389,16 +389,13 @@ public final class DefaultServerAttribut
             {
                 Value<String> newValue = new ServerStringValue( attributeType, val
);
                 
-                if ( !contains( newValue ) )
+                if ( add( newValue ) != 0 )
                 {
-                    if ( add( newValue ) != 0 )
-                    {
-                        nbAdded++;
-                    }
-                    else
-                    {
-                        LOG.error( I18n.err( I18n.ERR_94, val ) );
-                    }
+                    nbAdded++;
+                }
+                else
+                {
+                    LOG.error( I18n.err( I18n.ERR_94, val ) );
                 }
             }
             
@@ -429,20 +426,16 @@ public final class DefaultServerAttribut
                 {
                     Value<String> nullSV = new ServerStringValue( attributeType, (String)null
);
                     
-                    if ( !values.contains( nullSV ) )
+                    if ( values.add( nullSV ) )
                     {
-                        values.add( nullSV );
                         nbAdded++;
                     }
                 }
                 else if ( val instanceof ServerStringValue )
                 {
-                    if ( !values.contains( val ) )
+                    if ( values.add( val ) )
                     {
-                        if ( values.add( val ) )
-                        {
-                            nbAdded++;
-                        }
+                        nbAdded++;
                     }
                 }
                 else if ( val instanceof ClientStringValue )
@@ -450,12 +443,9 @@ public final class DefaultServerAttribut
                     // If we get a Client value, convert it to a Server value first 
                     Value<String> serverStringValue = new ServerStringValue( attributeType,
val.getString() ); 
                     
-                    if ( !values.contains( serverStringValue ) )
+                    if ( values.add( serverStringValue ) )
                     {
-                        if ( values.add( serverStringValue ) )
-                        {
-                            nbAdded++;
-                        }
+                        nbAdded++;
                     }
                 }
                 else
@@ -470,9 +460,8 @@ public final class DefaultServerAttribut
                 {
                     Value<byte[]> nullSV = new ServerBinaryValue( attributeType, (byte[])null
);
                     
-                    if ( !values.contains( nullSV ) )
+                    if ( values.add( nullSV ) )
                     {
-                        values.add( nullSV );
                         nbAdded++;
                     }
                 }
@@ -480,22 +469,16 @@ public final class DefaultServerAttribut
                 {
                     Value<byte[]> serverBinaryValue = new ServerBinaryValue( attributeType,
val.getBytes() ); 
                     
-                    if ( !values.contains( serverBinaryValue ) )
+                    if ( values.add( serverBinaryValue ) )
                     {
-                        if ( values.add( serverBinaryValue ) )
-                        {
-                            nbAdded++;
-                        }
+                        nbAdded++;
                     }
                 }
                 else if ( val instanceof ServerBinaryValue )
                 {
-                    if ( !values.contains( val ) )
+                    if ( values.add( val ) )
                     {
-                        if ( values.add( val ) )
-                        {
-                            nbAdded++;
-                        }
+                        nbAdded++;
                     }
                 }
                 else



Mime
View raw message