From 1f49f2a7373909e9dc04ad6567f5c6246e3ef9a0 Mon Sep 17 00:00:00 2001 From: Byounghui Date: Tue, 17 Sep 2013 15:52:06 +0900 Subject: [PATCH] duplicate error for listner fixed. Change-Id: I1d66ca0eda44c212f3744240b42973a125b82f4b Signed-off-by: Byounghui --- src/messaging/FMsg_IpcCallbackHandler.cpp | 10 ++++++++++ src/messaging/FMsg_SmsService.cpp | 12 ++++++------ src/messaging/FMsg_WapPushService.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/messaging/FMsg_IpcCallbackHandler.cpp b/src/messaging/FMsg_IpcCallbackHandler.cpp index 929d86e..fa75580 100644 --- a/src/messaging/FMsg_IpcCallbackHandler.cpp +++ b/src/messaging/FMsg_IpcCallbackHandler.cpp @@ -801,6 +801,11 @@ _IpcCallbackHandler::SetWapPushClientId(const Tizen::Base::String& AppId, int id SysLog(NID_MSG, "AppId %ls, Client %d",AppId.GetPointer(), id); return r; } + else + { + r = E_OBJ_ALREADY_EXIST; + + } delete pId; delete pApp; @@ -835,6 +840,11 @@ _IpcCallbackHandler::SetSmsClientId (int port, int id) SysLog(NID_MSG, "Port %ls, Client %d",pPort->GetPointer(), id); return r; } + else + { + r = E_OBJ_ALREADY_EXIST; + + } delete pId; delete pPort; diff --git a/src/messaging/FMsg_SmsService.cpp b/src/messaging/FMsg_SmsService.cpp index b33ef38..ae27141 100644 --- a/src/messaging/FMsg_SmsService.cpp +++ b/src/messaging/FMsg_SmsService.cpp @@ -179,12 +179,12 @@ _SmsService::AddSmsEventListener(int port, int clientId) result r = E_SUCCESS; int err = MSG_SUCCESS; - SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetSmsClientId(port, clientId)== E_SUCCESS, r = E_SYSTEM, r, "failed to save client id."); + SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetSmsClientId(port, clientId)== E_SUCCESS, , r, "[%s] failed to save client id.", GetErrorMessage(r)); // Register SMS Trigger err = msg_reg_sms_message_callback(__msgHandle, &_IpcCallbackHandler::IncomingSmsCallback, port, null); - - SysTryReturn(NID_MSG, err == MSG_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Failed to register for incoming sms callback.", GetErrorMessage(r)); - return r; + SysTryCatch(NID_MSG, err == MSG_ERR_INVALID_PARAMETER || r == E_SUCCESS, , r, "[%s] Failed to register for incoming sms callback.", GetErrorMessage(r)); + + return E_SUCCESS; CATCH: return r; @@ -201,11 +201,11 @@ _SmsService::AddCbsEtwsEventListener(bool enabled, int clientId) result r = E_SUCCESS; int err = MSG_SUCCESS; - SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetCbsEtwsClientId(clientId)== E_SUCCESS, r = E_SYSTEM, r, "failed to save client id."); + SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetCbsEtwsClientId(clientId)== E_SUCCESS, r = E_SYSTEM, r, "[%s] failed to save client id.", GetErrorMessage(r)); err = msg_reg_cb_message_callback(__msgHandle, &_IpcCallbackHandler::IncomingCbsMessageCallback, enabled, null); r = ConvertException(err); - SysTryCatch(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to set cbs incoming callback"); + SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to set cbs incoming callback", GetErrorMessage(r)); return r; diff --git a/src/messaging/FMsg_WapPushService.cpp b/src/messaging/FMsg_WapPushService.cpp index 081b6a7..cbdeda5 100644 --- a/src/messaging/FMsg_WapPushService.cpp +++ b/src/messaging/FMsg_WapPushService.cpp @@ -124,9 +124,9 @@ _WapPushService::AddWapPushEventListener(const Tizen::Base::String& wapApplicati SysLog(NID_MSG, "wapApp: %ls", wapApplicationId.GetPointer()); pWapAppId = _StringConverter::CopyToCharArrayN(wapApplicationId); - SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed"); - SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetWapPushClientId(wapApplicationId, clientId)== E_SUCCESS, r = E_SYSTEM, r, "failed to save client id."); - SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance() != null, r = E_OUT_OF_MEMORY, r, "failed to get msg handle."); + SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "[%s] memory allocation failed", GetErrorMessage(r)); + SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance()->SetWapPushClientId(wapApplicationId, clientId)== E_SUCCESS, , r, "[%s] failed to save client id.", GetErrorMessage(r)); + SysTryCatch(NID_MSG, _IpcCallbackHandler::GetInstance() != null, r = E_OUT_OF_MEMORY, r, "[%s] failed to get msg handle.", GetErrorMessage(r)); // open message handle err = _IpcCallbackHandler::GetInstance()->OpenMessageHandle(__msgHandle); @@ -141,7 +141,7 @@ _WapPushService::AddWapPushEventListener(const Tizen::Base::String& wapApplicati err = msg_reg_push_message_callback(__msgHandle, &_IpcCallbackHandler::IncomingWapPushMessageCallback, pWapAppId, (void*) null); r = ConvertException(err); - SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Add WapPush EventListener.", GetErrorMessage(r)); + SysTryCatch(NID_MSG, err == MSG_ERR_INVALID_PARAMETER || r == E_SUCCESS, , r, "[%s] Failed to Add WapPush EventListener.", GetErrorMessage(r)); if (pWapAppId) { @@ -149,7 +149,7 @@ _WapPushService::AddWapPushEventListener(const Tizen::Base::String& wapApplicati pWapAppId = null; } - return r; + return E_SUCCESS; CATCH: if (pWapAppId) -- 2.7.4