Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 90321 invoked from network); 21 May 2010 10:34:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 May 2010 10:34:58 -0000 Received: (qmail 66598 invoked by uid 500); 21 May 2010 10:34:58 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 66450 invoked by uid 500); 21 May 2010 10:34:58 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 66442 invoked by uid 99); 21 May 2010 10:34:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 May 2010 10:34:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 21 May 2010 10:34:55 +0000 Received: (qmail 90297 invoked from network); 21 May 2010 10:34:33 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by 127.0.0.1 with SMTP; 21 May 2010 10:34:33 -0000 Message-ID: <4BF661B8.6050604@apache.org> Date: Fri, 21 May 2010 12:34:32 +0200 From: Stefan Seelmann User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: equals() implementation in ProtectedItem References: <4BF528A7.9060006@otego.com> <4BF62BFC.30705@apache.org> <4BF6441B.8060203@apache.org> <4BF6565F.6070406@apache.org> In-Reply-To: <4BF6565F.6070406@apache.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Stefan Seelmann schrieb: > Felix Knecht wrote: >>>> Are you aware, that this [1] is an equal of collections and will return >>>> in most cases "false" as it is a reference comparison [2]? >> Thanks to test cases :) >>> I checked the history. Previously we didn't use >>> Collections.unmodifiableCollection( attributeTypes ) >>> And a quick check shows that the callers of the construtor always pass >>> an java.util.Set. >>> For two Sets the equals method would work correctly, but the creation of >>> the unmodifyalbe collection not. >>> I think we have two options: >>> - use CollectionUtils.isEqualCollection() from commons collections, this >>> seems to do the right thing. >>> - try to change the parameter type from Collection to Set in the >>> constructors and use Collections.unmodifiableSet() instead. >>> Thoughts? >> It dependes on the content we have in the collections. Set doesn't >> allows duplicates wheras with certain collection implementations this is >> possible. >> > > I checked X.501 specification [1], Annex E, page 173. It clearly states > that in ProtectedItem all elments (attributeType, allAttributeValues, > attributeValue, selfValue, maxValueCount, restrictedBy) are *sets*. > > I'm going to change all Collection types to Sets and activate your tests. Done. Thanks Felix for the test cases :-) Kind Regards, Stefan