Bug 439819 – LDIF import does not include mozillahomestreet
I have been writing unit tests for importing address books and finally performed my first tests of verifying the imported data. It turns out that LDIF doesn’t import mozillahomestreet (Home Address line 1) even though it worked with mozillahomestreet2.
So I filed Bug 439819. The problem was in mailnews/addrbook/src/nsAbLDIFService.cpp. For whatever reason, the first line of the address isn’t included in all the else ifs. The patch is simple and is included in the bug report.
Status: Patch waiting for sr. Test waiting for bug 437556
Bug 437556
A while ago I mentioned that I accidentally crashed Thunderbird while figuring out how to import an Address Book because I forgot to set the fieldMap before I called BeginImport. So, I filed Bug 437556: Mailnews crashes while importing an address book if a field map is required but not set. After receiving comments on previous patches, I believe the following code should stop the import, log an error, and return false if the field map isn’t set when it needs to be.
PRBool needsFieldMap = PR_FALSE;
if (NS_FAILED(m_pInterface->GetNeedsFieldMap(m_pLocation, &needsFieldMap)) ||
(needsFieldMap && !m_pFieldMap)) {
nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTINITIALIZED,
m_stringBundle, error);
SetLogs(success, error, successLog, errorLog);
*_retval = PR_FALSE;
return NS_OK;
}
Included in the patch is a simple unit test to check that BeginImport returns false if the fieldMap isn’t set. I am in the process of writing more unit tests for importing address books.
Here is the bug report with the patch and the test.
Update: The patch was checked in, but the original test failed on Windows builds and the new one is waiting for feedback.
-
Archives
- June 2009 (1)
- May 2009 (3)
- April 2009 (3)
- March 2009 (4)
- February 2009 (3)
- January 2009 (3)
- November 2008 (1)
- October 2008 (2)
- September 2008 (1)
- August 2008 (14)
- July 2008 (14)
- June 2008 (9)
-
Categories
-
RSS
Entries RSS
Comments RSS