On Mon, 2012-09-10 at 15:08 +0200, Ferrandis, Ludovic wrote:
I found some consistency issues about getting properties.
The first one is about returning an error for a valid property, but
In this case we return MSU_ERROR_UNKNOWN_PROPERTY error. This is
I think we should return the empty value, and return
MSU_ERROR_UNKNOWN_PROPERTY only when getProp is called on an undefined
The second one is a mix of code & doc bug.
Some properties are defined mandatory, other optionals.
When we call GetAllProperties we should at least return all mandatory
properties (even empty) and only optional properties that have data
Currently we only return properties with data, even for the mandatory
Second option is to always return all properties, mandatory and
optional, empty or not.
As far as I can tell the code at least is consistent. GetProp returns
an error if a property is not defined, even if it is mandatory and
GetAll returns only defined properties, omitting undefined properties
marked as mandatory in the documentation and the specs. ListChildren
and Search behave in the same way. What is confusing, as you rightly
point out, is that an application can potentially receive a property not
found error when attempting to retrieve a mandatory property, which
according to the specs, should exist.
We could leave things the way they are and let applications trap the
errors and provide defaults, but since one of the motivations behind
dLeyna is to make life easier for DLNA applications, we should probably
change the code to behave as you suggest, i.e. to provide default values
for missing mandatory properties. However, remember that:
1. There are different types of mandatory properties and we would need
to provide sensible default values for all properties. It may be more
complicated than simply returning an empty string.
2. The behaviour of GetAll, Search and ListChildren must remain
consistent. So if GetAll starts returning default values for undefined
mandatory properties, Search and ListChildren must do so as well, unless
of course the caller has chosen to filter them out. I think this should
mostly come for free if we add our code to the right place, but it still
needs to be tested.
Open Source Technology Center
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
dLeyna mailing list