When calling constructResourceObject, it probably throws an exception.
To avoid a sudden crash for it, we add exception handling to it.
Additionaly, in oicgroup file, there is a condition statement which
may lead wrong way from what we expect. Thus we remove it.
Change-Id: Ibc12cd261ca875738446ad3b10b199ae15497654
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3865
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
{
OC_LOG(INFO, TAG, "Build OCAction Instance.");
{
OC_LOG(INFO, TAG, "Build OCAction Instance.");
- if(action)
- {
- OICFree(action->resourceUri);
- OICFree(action);
- }
action = (OCAction*) OICMalloc(sizeof(OCAction));
VARIFY_POINTER_NULL(action, result, exit)
memset(action, 0, sizeof(OCAction));
action = (OCAction*) OICMalloc(sizeof(OCAction));
VARIFY_POINTER_NULL(action, result, exit)
memset(action, 0, sizeof(OCAction));
std::string host = getHostFromURI(oit->getUri());
std::string host = getHostFromURI(oit->getUri());
- tempResource = OCPlatform::constructResourceObject(host, uri, CT_ADAPTER_IP, true,
- oit->getResourceTypes(), m_if);
+ try
+ {
+ tempResource = OCPlatform::constructResourceObject(host, uri, CT_ADAPTER_IP, true,
+ oit->getResourceTypes(), m_if);
- p_resources.push_back(tempResource);
+ p_resources.push_back(tempResource);
+ } catch (std::exception& e)
+ {
+ std::cout << "Exception: " << e.what() << std::endl;
+ }
}
// Send GET messages to the child resources in turn.
}
// Send GET messages to the child resources in turn.