fix tc failure
authorGwangbok Kim <gwangbok.kim@samsung.com>
Wed, 8 May 2013 05:59:23 +0000 (14:59 +0900)
committerGwangbok Kim <gwangbok.kim@samsung.com>
Wed, 8 May 2013 05:59:23 +0000 (14:59 +0900)
Change-Id: I2759a3062825b0275272491dd443b02848256cfa
Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
src/FScl_AddressbookUtil.cpp

index 1c560bb..5f44972 100644 (file)
@@ -70,6 +70,9 @@ __ContactsContact::ConvertResultTo<Contact>(__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<Contact> pContact(new (std::nothrow) Contact());
        SysTryReturn(NID_SCL, pContact != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
@@ -95,6 +98,9 @@ __ContactsGroup::ConvertResultTo<Category>(__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<Category> pCategory(new (std::nothrow) Category());
        SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
@@ -135,12 +141,12 @@ __ContactsGroupRelation::ConvertResultTo<Category>(__SearchResult<__ContactsGrou
        contacts_record_h currentRecord = searchResult.GetCurrentRecord();
        SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       std::unique_ptr<Category> 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<Category> 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<Category>(__SearchResult<__ContactsCo
        contacts_record_h currentRecord = searchResult.GetCurrentRecord();
        SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       std::unique_ptr<Category> 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<Category> 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<Contact>(__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<Contact> 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<Contact>(__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<Contact> 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<EmailContact>(__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<EmailContact> 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<Contact>(__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<Contact> 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<PhoneNumberContact>(__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<PhoneNumberContact> pPhoneNumberContact(new (std::nothrow) PhoneNumberContact());
        SysTryReturn(NID_SCL, pPhoneNumberContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));