Prevent fix
authorSunwook Bae <sunwook45.bae@samsung.com>
Mon, 8 Apr 2013 01:44:28 +0000 (10:44 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Mon, 8 Apr 2013 01:44:28 +0000 (10:44 +0900)
Change-Id: I4a64918d76f3d032dc76abe571a601201cd17954
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
src/io/FIo_MessagePortProxy.cpp

index 0f637b5..c377385 100644 (file)
@@ -51,7 +51,7 @@ static const int MAX_MESSAGE_SIZE = 16 * 1024;
 static void
 ConvertBundleToMap(const char *pKey, const int type, const bundle_keyval_t *pVal, void *pData)
 {
-       SysLog(NID_IO, "CB key = %s", pKey);
+       //SysLog(NID_IO, "CB key = %s", pKey);
 
        HashMap* pMap = static_cast<HashMap*>(pData);
 
@@ -72,16 +72,18 @@ ConvertBundleToMap(const char *pKey, const int type, const bundle_keyval_t *pVal
                        case BUNDLE_TYPE_BYTE:
                                bundle_keyval_get_basic_val(const_cast<bundle_keyval_t*>(pVal), reinterpret_cast<void**>(&pStr), &size);
 
-                               SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
+                               //SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
 
                                if (pStr)
                                {
                                        ByteBuffer* pBuffer = new (std::nothrow) ByteBuffer();
-                                       SysTryReturn(NID_IO, pMap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+                                       SysTryReturnVoidResult(NID_IO, pMap != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
                                        result r = pBuffer->Construct(size);
-                                       SysTryReturn(NID_IO, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+                                       SysTryCatch(NID_IO, r == E_SUCCESS, delete pBuffer, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+                                       r = pBuffer->SetArray((const byte*)pStr, 0, size);
+                                       SysTryCatch(NID_IO, r == E_SUCCESS, delete pBuffer, E_INVALID_ARG, "[E_INVALID_ARG] The buffer argument is invalid.");
 
-                                       pBuffer->SetArray((const byte*)pStr, 0, size);
                                        pBuffer->Flip();
 
                                        pMap->Add(new (std::nothrow) String(pKey), pBuffer);
@@ -93,6 +95,9 @@ ConvertBundleToMap(const char *pKey, const int type, const bundle_keyval_t *pVal
                                break;
                }
        }
+
+CATCH:
+       return;
 }
 
 static void
@@ -114,7 +119,7 @@ OnMessageReceived(int id, const char* remote_app_id, const char* remote_port, bo
                return;
        }
 
-       SysLog(NID_IO, "local port name: %s", pLocalPort);
+       //SysLog(NID_IO, "local port name: %s", pLocalPort);
 
        _IMessagePortListener* pListener = null;
        p->__listeners.GetValue(pLocalPort, pListener);
@@ -129,8 +134,6 @@ OnMessageReceived(int id, const char* remote_app_id, const char* remote_port, bo
                result r = pMap->Construct();
                SysTryCatch(NID_IO, r == E_SUCCESS, delete pMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               SysLog(NID_IO, "bundle to map");
-
                bundle_foreach(data, ConvertBundleToMap, pMap);
 
                if (remote_app_id == null) // Uni-directional
@@ -189,6 +192,7 @@ OnTrustedMessageReceived(int id, const char* remote_app_id, const char* remote_p
                else // Bi-directional
                {
                        SysLog(NID_IO, "Trusted message received from [%s:%s], trusted: %d", remote_app_id, remote_port, trusted_port);
+
                        pListener->OnMessageReceivedN(remote_app_id, remote_port, trusted_port, pMap);
                }
        }