directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r597268 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java
Date Thu, 22 Nov 2007 00:07:20 GMT
Author: elecharny
Date: Wed Nov 21 16:07:19 2007
New Revision: 597268

URL: http://svn.apache.org/viewvc?rev=597268&view=rev
Log:
Rearange the fix for DIRSERVER-1104, as it was also present in other places.

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=597268&r1=597267&r2=597268&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
Wed Nov 21 16:07:19 2007
@@ -308,7 +308,7 @@
                 return true;
 
             case 1:
-                exists = value.equals( attrVal );
+                exists = contains( attrVal );
 
                 if ( exists )
                 {
@@ -326,7 +326,7 @@
                 }
 
             default:
-                exists = list.contains( attrVal );
+                exists = contains( attrVal );
 
                 list.add( attrVal );
                 size++;
@@ -351,67 +351,40 @@
                 return false;
 
             case 1:
-                if ( attrVal instanceof byte[] )
+                if ( contains( attrVal ) )
                 {
-                    if ( value instanceof byte[] )
-                    {
-                        byte[] valByte = ( byte[] ) value;
-
-                        if ( Arrays.equals( valByte, ( byte[] ) attrVal ) )
-                        {
-                            value = null;
-                            size--;
-                            return true;
-                        }
-                        else
-                        {
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        return false;
-                    }
+                    value = null;
+                    size--;
+                    return true;
                 }
                 else
                 {
-                    if ( value.equals( attrVal ) )
-                    {
-                        value = null;
-                        size--;
-                        return true;
-                    }
-                    else
-                    {
-                        return false;
-                    }
+                    return false;
                 }
 
             case 2:
-                if ( attrVal instanceof byte[] )
+                if ( contains( attrVal ) )
                 {
-                    for ( Object val : list )
+                    if ( attrVal instanceof byte[] )
                     {
-                        if ( val instanceof byte[] )
+                        for ( Object val : list )
                         {
-                            byte[] valByte = ( byte[] ) val;
-
-                            if ( Arrays.equals( valByte, ( byte[] ) attrVal ) )
+                            if ( val instanceof byte[] )
                             {
-                                list.remove( valByte );
-                                value = list.get( 0 );
-                                size = 1;
-                                list = null;
-                                return true;
+                                if ( Arrays.equals( ( byte[] )val, ( byte[] ) attrVal ) )
+                                {
+                                    list.remove( val );
+                                    value = list.get( 0 );
+                                    size = 1;
+                                    list = null;
+                                    return true;
+                                }
                             }
                         }
+    
+                        return false;
                     }
-
-                    return false;
-                }
-                else
-                {
-                    if ( list.contains( attrVal ) )
+                    else
                     {
                         list.remove( attrVal );
                         value = list.get( 0 );
@@ -419,44 +392,42 @@
                         list = null;
                         return true;
                     }
-                    else
-                    {
-                        return false;
-                    }
+                }
+                else
+                {
+                    return false;
                 }
 
             default:
-                if ( attrVal instanceof byte[] )
+                if ( contains( attrVal ) )
                 {
-                    for ( Object val : list )
+                    if ( attrVal instanceof byte[] )
                     {
-                        if ( val instanceof byte[] )
+                        for ( Object val : list )
                         {
-                            byte[] valByte = ( byte[] ) val;
-
-                            if ( Arrays.equals( valByte, ( byte[] ) attrVal ) )
+                            if ( val instanceof byte[] )
                             {
-                                list.remove( attrVal );
-                                size--;
-                                return true;
+                                if ( Arrays.equals( ( byte[] ) val, ( byte[] ) attrVal )
)
+                                {
+                                    list.remove( val );
+                                    size--;
+                                    return true;
+                                }
                             }
                         }
+    
+                        return false;
                     }
-
-                    return false;
-                }
-                else
-                {
-                    if ( list.contains( attrVal ) )
+                    else
                     {
                         list.remove( attrVal );
                         size--;
                         return true;
                     }
-                    else
-                    {
-                        return false;
-                    }
+                }
+                else
+                {
+                    return false;
                 }
         }
     }



Mime
View raw message