Differences in contact api implementation

Hi guys, long time. At risk of minor noise pollution I'm forwarding an
email from phonegap ios hacker Becky Gibson about a conflict we're
having in spec interpretation.

Our problem is in  find() on contacts. If a contact has a field that
is an array and it is empty should we return null or []?

The spec isn't particularly clear (or very clear that it should be
null if you read below) though my intuition would say an empty array
is 'the right thing to do'.

Your input is greatly appreciated!



---------- Forwarded message ----------
From: Becky Gibson <Becky_Gibson@notesdev.ibm.com>


I just found a difference in the contacts implementation between
Android/BB and iOS.

When you do a contacts.find() with Android or BB, if there are array
fields that have no data,  an empty array is returned for that field
value.  I you perform the find on iOS and an array field has no data,
null is returned for that field value.

It comes down to a different interpretation of the spec:

Simon and Justin followed the same behavior as for the return of the
contacts object:

"If a ContactFindOptionsobject is provided to the
Contactsfind()operation and its multipleattribute is set to true, the
Contactsfind()operation must return either an empty sequence, a single
Contactobject or [X] number of Contactobjects, accessible as part of
the sequence returned in the ContactFindCBcallback function.
(http://dev.w3.org/2009/dap/contacts/#search-cardinality)"

And, Justin thinks the return values for arrays may have been
specified in a previous version of the specification but we can't find
it now.

I followed the behavior outlined for the Contact object itself.

"All Contactobjects must include all attributes supported by the
implementation, regardless of whether these attributes have been
assigned a non-nullvalue or a null value. If a supported attribute has
not been assigned a value by the user and/or implementation, then this
attribute must still be present in the resulting Contactobject and
must have a value of null.
(http://dev.w3.org/2009/dap/contacts/#contact-interface)"

The difference is easily worked around,  check array fields for null
before accessing them.  I'll add that to the iOS quirks section.
However, we do need to get this clarified in the W3C Contacts API and
eventually harmonized, perhaps Brian can help us there.

-becky



Becky Gibson

IBM Emerging Internet Technologies
5 Technology Park Drive
Westford, MA 01886
Voice: 978 399-6101; t/l 333-6101
Email: gibsonb@us.ibm.com
blog: weba11y.com/blog
twitter: http://twitter.com/becka11y

Received on Friday, 4 February 2011 17:56:09 UTC