Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 24683 invoked from network); 22 Nov 2007 00:07:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Nov 2007 00:07:41 -0000 Received: (qmail 96963 invoked by uid 500); 22 Nov 2007 00:07:29 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 96920 invoked by uid 500); 22 Nov 2007 00:07:28 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 96909 invoked by uid 99); 22 Nov 2007 00:07:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2007 16:07:28 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Nov 2007 00:07:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9B7BC1A9832; Wed, 21 Nov 2007 16:07:20 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071122000720.9B7BC1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; } } }