You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/11/11 23:30:24 UTC

svn commit: r593981 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java

Author: elecharny
Date: Sun Nov 11 14:30:23 2007
New Revision: 593981

URL: http://svn.apache.org/viewvc?rev=593981&view=rev
Log:
Fixed a bug in the way we handled the removal of values : if the value to be removed didn't exist into the attribute, some randmo value was removed from the attribute !!!

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java?rev=593981&r1=593980&r2=593981&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java Sun Nov 11 14:30:23 2007
@@ -345,21 +345,42 @@
                 return false;
                 
             case 1 :
-                value = null;
-                size--;
-                return true;
+                if ( value.equals(  attrVal ) )
+                {
+                    value = null;
+                    size--;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
                 
             case 2 : 
-                list.remove( attrVal );
-                value = list.get(0);
-                size = 1;
-                list = null;
-                return true;
+                if ( list.contains( attrVal ) )
+                {
+                    list.remove( attrVal );
+                    value = list.get(0);
+                    size = 1;
+                    list = null;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
                 
             default :
-                list.remove( attrVal );
-                size--;
-                return true;
+                if ( list.contains( attrVal ) )
+                {
+                    list.remove( attrVal );
+                    size--;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
         }
     }