Commit 8b776fc5 authored by KIM JungYong's avatar KIM JungYong Committed by Uze Choi

Fix bugs for no catch std::out_of_range exceptions.

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: default avatarKIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13859Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent 4b8a8968
......@@ -262,10 +262,14 @@ bool discoverResource()
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));
......
......@@ -151,7 +151,15 @@ void selectResourceType()
int main(void)
{
try
{
selectResourceType();
}
catch(...)
{
std::cout << "Can't select Resource Type" << std::endl;
return -1;
}
std::cout << "Resource successfully created!" << std::endl;
......
......@@ -536,6 +536,8 @@ int main()
continue;
}
try
{
if (g_thingsMnt->reboot(g_maintenanceCollection, &onReboot) != OC_STACK_ERROR)
{
pthread_mutex_lock(&mutex_lock);
......@@ -543,6 +545,11 @@ int main()
pthread_mutex_unlock(&mutex_lock);
}
}
catch(...)
{
std::cout<<"Reboot fail." << std::endl;
}
}
else if (g_Steps == 10)
{
std::cout << g_thingsConf->getListOfSupportedConfigurationUnits() << std::endl;
......
......@@ -290,6 +290,8 @@ int main()
break;
}
else if (g_Steps == 1)
{
try
{
if( g_thingsConf->doBootstrap(&onBootstrap) == OC_STACK_OK)
{
......@@ -302,6 +304,11 @@ int main()
std::cout << "A callback pointer of the function is NULL." << std::endl;
}
}
catch(...)
{
std::cout << "doBootstrap fail." << std::endl;
}
}
else if (g_Steps == 2)
{
myConfigurationResource = new ConfigurationResource();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment