oc/MAPIStoreMapping: Split the check for existing entry so we have better error message

Signed-off-by: Kamen Mazdrashki <kmazdrashki@zentyal.com>
This commit is contained in:
Kamen Mazdrashki
2014-06-13 14:20:00 +02:00
committed by Julio García
parent 98505c1b6b
commit 6de298d202

View File

@@ -217,14 +217,22 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
bool rc;
oldURL = [self urlFromID: idNbr];
oldIdNbr = [self idFromURL: urlString];
if (oldURL != NULL || oldIdNbr != NSNotFound)
if (oldURL != NULL)
{
[self errorWithFormat:
@"attempt to double register an entry ('%@', %lld,"
@" 0x%.16"PRIx64")",
urlString, idNbr, idNbr];
rc = NO;
@"url with idNbr already registered: (oldUrl='%@', newUrl='%@', id=x%.16"PRIx64")",
oldURL, urlString, idNbr];
return NO;
}
oldIdNbr = [self idFromURL: urlString];
if (oldIdNbr != NSNotFound)
{
[self errorWithFormat:
@"attempt to double register an entry with idNbr ('%@', %lld,"
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
urlString, idNbr, idNbr, oldIdNbr];
return NO;
}
else
{