Samples of serveral services, no catch exception about out_of_range.
With this patch, all of exception was caught.
Change-Id: I18b9cf7633ac6c6ad3d5a8b9e37a5110ffd9d68f
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13859
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
RCSDiscoveryManager::getInstance()->discoverResourceByType(RCSAddress::multicast(),
resourceType, &onResourceDiscovered);
}
- catch(const RCSPlatformException& e)
+ catch (const RCSPlatformException& e)
{
std::cout << e.what() << std::endl;
}
+ catch (...)
+ {
+ std::cout << "unknown exception" << std::endl;
+ }
std::unique_lock<std::mutex> lck(mtx);
cond.wait_for(lck, std::chrono::seconds(2));
int main(void)
{
- selectResourceType();
+ try
+ {
+ selectResourceType();
+ }
+ catch(...)
+ {
+ std::cout << "Can't select Resource Type" << std::endl;
+ return -1;
+ }
std::cout << "Resource successfully created!" << std::endl;
continue;
}
- if (g_thingsMnt->reboot(g_maintenanceCollection, &onReboot) != OC_STACK_ERROR)
+ try
{
- pthread_mutex_lock(&mutex_lock);
- isWaiting = 0;
- pthread_mutex_unlock(&mutex_lock);
+ if (g_thingsMnt->reboot(g_maintenanceCollection, &onReboot) != OC_STACK_ERROR)
+ {
+ pthread_mutex_lock(&mutex_lock);
+ isWaiting = 0;
+ pthread_mutex_unlock(&mutex_lock);
+ }
+ }
+ catch(...)
+ {
+ std::cout<<"Reboot fail." << std::endl;
}
}
else if (g_Steps == 10)
}
else if (g_Steps == 1)
{
- if( g_thingsConf->doBootstrap(&onBootstrap) == OC_STACK_OK)
+ try
{
- pthread_mutex_lock(&mutex_lock);
- isWaiting = 1;
- pthread_mutex_unlock(&mutex_lock);
+ if( g_thingsConf->doBootstrap(&onBootstrap) == OC_STACK_OK)
+ {
+ pthread_mutex_lock(&mutex_lock);
+ isWaiting = 1;
+ pthread_mutex_unlock(&mutex_lock);
+ }
+ else
+ {
+ std::cout << "A callback pointer of the function is NULL." << std::endl;
+ }
}
- else
+ catch(...)
{
- std::cout << "A callback pointer of the function is NULL." << std::endl;
+ std::cout << "doBootstrap fail." << std::endl;
}
}
else if (g_Steps == 2)