Fix an exception handling issue in doBootStrap() function of
authorjihun.ha <jihun.ha@samsung.com>
Wed, 24 Dec 2014 04:46:37 +0000 (13:46 +0900)
committerjihun.ha <jihun.ha@samsung.com>
Wed, 24 Dec 2014 04:46:37 +0000 (13:46 +0900)
ThingsConfiguration class.

In the case that a callback pointer of the function is NULL,
a return value for the function call will be OC_STACK_ERROR
rather than OC_STACK_OK.

Reference issue ID : [IOT-196]

Change-Id: Ieb280bc6e5317496b96342a0374129c1e692b415
Signed-off-by: jihun.ha <jihun.ha@samsung.com>
service/things-manager/sampleapp/linux/configuration/con-server.cpp [changed mode: 0644->0755]
service/things-manager/sdk/src/ThingsConfiguration.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 6b26437..c83c7a0
@@ -325,8 +325,10 @@ int main()
                 break;
             else if (g_Steps == 1)
             {
-                g_thingsmanager->doBootstrap(&onBootstrap);
-                isWaiting = 1;
+                if( g_thingsmanager->doBootstrap(&onBootstrap) == OC_STACK_OK)
+                    isWaiting = 1;
+                else
+                    std::cout << "A callback pointer of the function is NULL." << std::endl;
             }
             else if (g_Steps == 2)
             {
old mode 100644 (file)
new mode 100755 (executable)
index a0f57a2..5a4777f
@@ -597,7 +597,10 @@ namespace OIC
 
     OCStackResult ThingsConfiguration::doBootstrap(ConfigurationCallback callback)
     {
-        g_bootstrapCallback = callback;
+        if(callback == NULL)
+            return OC_STACK_ERROR;
+        else
+          g_bootstrapCallback = callback;
 
         // Find bootstrap server.
         std::vector < std::string > type;