From 28d9eab65c859f6a4abbc66d231a81ac7ecaff96 Mon Sep 17 00:00:00 2001 From: Gwangbok Kim Date: Wed, 8 May 2013 14:59:23 +0900 Subject: [PATCH] fix tc failure Change-Id: I2759a3062825b0275272491dd443b02848256cfa Signed-off-by: Gwangbok Kim --- src/FScl_AddressbookUtil.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/FScl_AddressbookUtil.cpp b/src/FScl_AddressbookUtil.cpp index 1c560bb..5f44972 100644 --- a/src/FScl_AddressbookUtil.cpp +++ b/src/FScl_AddressbookUtil.cpp @@ -70,6 +70,9 @@ __ContactsContact::ConvertResultTo(__SearchResult<__ContactsContact>& s contacts_record_h currentRecord = searchResult.GetCurrentRecord(); SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + contacts_record_get_int(currentRecord, _contacts_contact.id, &intValue); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pContact(new (std::nothrow) Contact()); SysTryReturn(NID_SCL, pContact != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); @@ -95,6 +98,9 @@ __ContactsGroup::ConvertResultTo(__SearchResult<__ContactsGroup>& sear contacts_record_h currentRecord = searchResult.GetCurrentRecord(); SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + contacts_record_get_int(currentRecord, _contacts_group.id, &intValue); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pCategory(new (std::nothrow) Category()); SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); @@ -135,12 +141,12 @@ __ContactsGroupRelation::ConvertResultTo(__SearchResult<__ContactsGrou contacts_record_h currentRecord = searchResult.GetCurrentRecord(); SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - std::unique_ptr pCategory(new (std::nothrow) Category()); - SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - contacts_record_get_int(currentRecord, _contacts_group_relation.group_id, &intValue); SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pCategory(new (std::nothrow) Category()); + SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + int ret = contacts_db_get_record(_contacts_group._uri, intValue, &newRecord); SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -183,12 +189,12 @@ __ContactsContactGroupRel::ConvertResultTo(__SearchResult<__ContactsCo contacts_record_h currentRecord = searchResult.GetCurrentRecord(); SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - std::unique_ptr pCategory(new (std::nothrow) Category()); - SysTryReturn(NID_SCL, pCategory != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - contacts_record_get_int(currentRecord, _contacts_contact_grouprel.group_id, &intValue); SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pCategory(new (std::nothrow) Category()); + SysTryReturn(NID_SCL, pCategory != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + int ret = contacts_db_get_record(_contacts_group._uri, intValue, &newRecord); SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -233,7 +239,7 @@ __ContactsContactGroupRel::ConvertResultTo(__SearchResult<__ContactsCon SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); contacts_record_get_int(currentRecord, _contacts_contact_grouprel.contact_id, &intValue); - SysTryReturn(NID_SCL, intValue >= 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); std::unique_ptr pContact(new (std::nothrow) Contact()); SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -263,7 +269,7 @@ __ContactsContactEmail::ConvertResultTo(__SearchResult<__ContactsContac SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); contacts_record_get_int(currentRecord, _contacts_contact_email.contact_id, &intValue); - SysTryReturn(NID_SCL, intValue >= 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); std::unique_ptr pContact(new (std::nothrow) Contact()); SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -293,6 +299,9 @@ __ContactsContactEmail::ConvertResultTo(__SearchResult<__ContactsC contacts_record_h recordHandle = queryResult.GetCurrentRecord(); SysTryReturn(NID_SCL, recordHandle != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + contacts_record_get_int(recordHandle, _contacts_contact_email.contact_id, &intValue); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pEmailContact(new (std::nothrow) EmailContact()); SysTryReturn(NID_SCL, pEmailContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -362,7 +371,7 @@ __ContactsContactNumber::ConvertResultTo(__SearchResult<__ContactsConta SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); contacts_record_get_int(currentRecord, _contacts_contact_number.contact_id, &intValue); - SysTryReturn(NID_SCL, intValue >= 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); std::unique_ptr pContact(new (std::nothrow) Contact()); SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -392,6 +401,9 @@ __ContactsContactNumber::ConvertResultTo(__SearchResult<__Co contacts_record_h recordHandle = queryResult.GetCurrentRecord(); SysTryReturn(NID_SCL, recordHandle != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + contacts_record_get_int(recordHandle, _contacts_contact_number.contact_id, &intValue); + SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); + std::unique_ptr pPhoneNumberContact(new (std::nothrow) PhoneNumberContact()); SysTryReturn(NID_SCL, pPhoneNumberContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); -- 2.7.4