felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: Why is config admin checking for empty collections in Configuration values?
Date Thu, 07 Aug 2014 06:48:48 GMT
Hi David

Hmm, good question. It has always been there - ever since it was first imported 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 it must be made sure the ConfigurationHandler
serializer can also read and write such empty collections.

Regards
Felix

Am 06.08.2014 um 03:35 schrieb David Jencks <david_jencks@yahoo.com.INVALID>:

> While writing a test I discovered that config admin doesn't like empty collections 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 for these restrictions, and they are not applied
to arrays.  What is the justification for these checks?
> 
> Here's the code I'm asking about (CaseInsensitiveDictionary lines 309ff)
> 
>            if ( collection.isEmpty() )
>            {
>                throw new IllegalArgumentException( "Collection must not be empty" );
>            }
> 
>            // ensure all elements have the same type and to internal list
>            Collection internalValue = new ArrayList( collection.size() );
>            type = null;
>            for ( Iterator ci = collection.iterator(); ci.hasNext(); )
>            {
>                Object el = ci.next();
>                if ( el == null )
>                {
>                    throw new IllegalArgumentException( "Collection must not contain null
elements" );
>                }
> 
> 
> thanks
> david jencks


Mime
View raw message