Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2203311699 for ; Thu, 7 Aug 2014 06:49:21 +0000 (UTC) Received: (qmail 75969 invoked by uid 500); 7 Aug 2014 06:49:21 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 75895 invoked by uid 500); 7 Aug 2014 06:49:20 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 75881 invoked by uid 99); 7 Aug 2014 06:49:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2014 06:49:20 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fmeschbe@adobe.com designates 207.46.163.181 as permitted sender) Received: from [207.46.163.181] (HELO na01-bn1-obe.outbound.protection.outlook.com) (207.46.163.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2014 06:49:16 +0000 Received: from DM2PR02MB446.namprd02.prod.outlook.com (10.141.88.16) by DM2PR02MB447.namprd02.prod.outlook.com (10.141.88.17) with Microsoft SMTP Server (TLS) id 15.0.995.14; Thu, 7 Aug 2014 06:48:49 +0000 Received: from DM2PR02MB446.namprd02.prod.outlook.com ([10.141.88.16]) by DM2PR02MB446.namprd02.prod.outlook.com ([10.141.88.16]) with mapi id 15.00.0995.014; Thu, 7 Aug 2014 06:48:48 +0000 From: Felix Meschberger To: Apache Felix Dev List Subject: Re: Why is config admin checking for empty collections in Configuration values? Thread-Topic: Why is config admin checking for empty collections in Configuration values? Thread-Index: AQHPsRbeVIoyCBOi9E2agfSRSsjWx5vEtRcA Date: Thu, 7 Aug 2014 06:48:48 +0000 Message-ID: <1A26599F-F2AC-4281-B42C-D648DDC89D6B@adobe.com> References: In-Reply-To: Accept-Language: de-CH, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.147.117.11] x-microsoft-antispam: BCL:0;PCL:0;RULEID: x-forefront-prvs: 029651C7A1 x-forefront-antispam-report: SFV:NSPM;SFS:(6009001)(189002)(51704005)(199002)(50986999)(92726001)(76176999)(110136001)(20776003)(64706001)(101416001)(76482001)(83716003)(66066001)(85306004)(106116001)(54356999)(79102001)(77982001)(81542001)(82746002)(99286002)(33656002)(80022001)(74502001)(74662001)(86362001)(83322001)(19580405001)(87936001)(36756003)(85852003)(4396001)(21056001)(83072002)(2656002)(19580395003)(46102001)(105586002)(106356001)(107046002)(107886001)(95666004)(104396001);DIR:OUT;SFP:;SCL:1;SRVR:DM2PR02MB447;H:DM2PR02MB446.namprd02.prod.outlook.com;FPR:;MLV:sfv;PTR:InfoNoRecords;MX:3;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-ID: <6AE8983FCF0FE745B458FFCFFF535893@namprd02.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: adobe.com X-Virus-Checked: Checked by ClamAV on apache.org Hi David Hmm, good question. It has always been there - ever since it was first impo= rted into the Felix project as part of FELIX-11. While an empty collection does not make that much sense, I think the check = doesn't either. On the other hand: If empty collections are allowed, then i= t must be made sure the ConfigurationHandler serializer can also read and w= rite such empty collections. Regards Felix Am 06.08.2014 um 03:35 schrieb David Jencks : > While writing a test I discovered that config admin doesn't like empty co= llections or collections with empty values as configuration values. After = searching the 5.0 config admin spec for a while I can't find any support fo= r these restrictions, and they are not applied to arrays. What is the just= ification for these checks? >=20 > Here's the code I'm asking about (CaseInsensitiveDictionary lines 309ff) >=20 > if ( collection.isEmpty() ) > { > throw new IllegalArgumentException( "Collection must not b= e empty" ); > } >=20 > // ensure all elements have the same type and to internal list > Collection internalValue =3D new ArrayList( collection.size() = ); > type =3D null; > for ( Iterator ci =3D collection.iterator(); ci.hasNext(); ) > { > Object el =3D ci.next(); > if ( el =3D=3D null ) > { > throw new IllegalArgumentException( "Collection must n= ot contain null elements" ); > } >=20 >=20 > thanks > david jencks