Fix the prevent problem.
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Fri, 5 Apr 2013 08:43:03 +0000 (17:43 +0900)
committerWonkyu Kwon <wonkyu.kwon@samsung.com>
Fri, 5 Apr 2013 10:10:05 +0000 (19:10 +0900)
 - (CID 44368) add catching exception coode

Change-Id: Ibf729869c87766e9590e614545262db02057efef

client/ClientChannel.cpp
common/Message.cpp
test-client/test-client.cpp

index 2e88817..afbf2a4 100644 (file)
@@ -149,6 +149,7 @@ namespace smartcard_service_api
                throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                int rv = SCARD_ERROR_OK;
+
                if (getSession()->getReader()->isSecureElementPresent() == true)
                {
                        Message msg;
index a9b815e..098528f 100644 (file)
@@ -206,7 +206,7 @@ namespace smartcard_service_api
                        break;
                }
 
-               snprintf(text, sizeof(text), "Message [%s, %d], param1 [%d], param2 [%d], error [%d], caller [%p], callback [%p], userParam [%p], data length [%d]", msg, message, param1, param2, error, caller, callback, userParam, data.getLength());
+               snprintf(text, sizeof(text), "Message [%s, %d], param1 [%ld], param2 [%ld], error [%ld], caller [%p], callback [%p], userParam [%p], data length [%d]", msg, message, param1, param2, error, caller, callback, userParam, data.getLength());
 
                return (const char *)text;
        }
index 1f6c14f..d55d0fe 100644 (file)
@@ -216,13 +216,25 @@ void testConnectedCallback(SEServiceHelper *service, void *userData)
 
 int main(int argv, char *args[])
 {
-       SEService *service = new SEService((void *)&user_context, &testEventHandler);
+       SEService *service = NULL;
 
-       loop = g_main_new(TRUE);
-       g_main_loop_run(loop);
+       try
+       {
+               service = new SEService((void *)&user_context, &testEventHandler);
+       }
+       catch (...)
+       {
+               SCARD_DEBUG_ERR("exception raised!!!");
+       }
 
        if (service != NULL)
-               delete service;
+       {
+               loop = g_main_new(TRUE);
+               g_main_loop_run(loop);
+
+               if (service != NULL)
+                       delete service;
+       }
 
        return 0;
 }