Fix result of static analyzer in primitive service.
authorKIM JungYong <jyong2.kim@samsung.com>
Wed, 22 Mar 2017 11:37:31 +0000 (20:37 +0900)
committerUze Choi <uzchoi@samsung.com>
Sat, 25 Mar 2017 06:30:55 +0000 (06:30 +0000)
In this patch, unhandled exception in the RC and RE was handled.

Change-Id: If6337a3fa9e9cc2c3a3b055bffe384f90d6b555c
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18091
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-container/examples/ContainerSampleClient.cpp
service/resource-encapsulation/examples/linux/NestedAttributesServer.cpp
service/resource-encapsulation/examples/linux/SampleResourceServer.cpp

index f239415..631f5fe 100644 (file)
@@ -722,9 +722,9 @@ int main(int argc, char *argv[])
         cv.wait(lock);
 
     }
-    catch (OCException &e)
+    catch (const OCException &e)
     {
-        oclog() << "Exception in main: " << e.what();
+        std::cout << "Exception in main: " << e.what();
     }
 
     return 0;
index b85ea15..005e0a5 100644 (file)
@@ -324,6 +324,10 @@ int main(void)
     {
         std::cout << "main exception  : " << e.what() << std::endl;
     }
+    catch (...)
+    {
+        std::cout << "main exception  : unknown" << std::endl;
+    }
 
     std::cout << "Stopping the server" << std::endl;
 }
index 3561cd5..9e919b6 100644 (file)
@@ -276,7 +276,14 @@ int main(void)
 
     if (g_isPresenceStarted)
     {
-        stopPresence();
+        try
+        {
+            stopPresence();
+        }
+        catch(...)
+        {
+            std::cout << "presence stop fail" << std::endl;
+        }
     }
 }