Wouter,

For the bug the best action to take would be to create a Jira ticket with a 
code snippet that will create the bug.  If it requires a lot of code to 
demonstrate the bug it can be attached to the Jira ticket or commited to gerrit 
with no intention of ever merging it.

List the "expected behavior" and the "actual behavior"

It is also good to list a work around in the jira ticket as well since the 
existence of work arounds are given consideration when giving priority to  bugs.

As far as documenting workarounds we don't really have a best place yet.

A few options: search the wiki and see if a good location for the information 
already exists. If not create a new page.

Is it something that should be in the API documentation then we modify the 
header file to include the information.

Both the issues look like the need to be addressed in a Jira ticket to me.

George Nash

From: [email protected] 
[mailto:[email protected]] On Behalf Of Wouter van der 
Beek (wovander)
Sent: Tuesday, January 23, 2018 9:20 AM
To: [email protected]
Subject: [dev] code documentation

Hi All,

I found some strange behaviours of code (basically there are bugs, but I found 
work arounds...)
This is needs to be documented somewhere as best practice of coding.
Where can this information be placed?


1)      C++ API

When handling request data, e.g. getting values from the supplied payload one 
should not use

rep.getValue("id", value) , this returns an Boolean and should not update the 
content value when the "id" is not there

But this is incorrect when using vector, it assigns 0....

Instead use rep.hasAttribute("id") to check if the id is in the payload.

If it is there, then handle it with getValue...

2)      C++ API
Avoid to return errors on POST when having vectors.
e.g. when an error has to be returned due to that an property being updated in 
an POST but it is marked readOnly
then the device can crash. To avoid this the readOnly optional properties can 
be removed.
For example remove readOnly params like: "precision", "maximumsaturation" from 
oic.r.colour.chroma
Note that the crash does not occur when no vectors are being used. E.g. no 
vectors : no issues.



Kind Regards,
Wouter

_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to