From 24ba99db32c63be53758e8c00dfd1ff02ebabbd1 Mon Sep 17 00:00:00 2001 From: Wonkyu Kwon Date: Fri, 5 Apr 2013 17:43:03 +0900 Subject: [PATCH] Fix the prevent problem. - (CID 44368) add catching exception coode Change-Id: Ibf729869c87766e9590e614545262db02057efef --- client/ClientChannel.cpp | 1 + common/Message.cpp | 2 +- test-client/test-client.cpp | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/client/ClientChannel.cpp b/client/ClientChannel.cpp index 2e88817..afbf2a4 100644 --- a/client/ClientChannel.cpp +++ b/client/ClientChannel.cpp @@ -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; diff --git a/common/Message.cpp b/common/Message.cpp index a9b815e..098528f 100644 --- a/common/Message.cpp +++ b/common/Message.cpp @@ -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; } diff --git a/test-client/test-client.cpp b/test-client/test-client.cpp index 1f6c14f..d55d0fe 100644 --- a/test-client/test-client.cpp +++ b/test-client/test-client.cpp @@ -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; } -- 2.7.4