--- a/persistentstorage/centralrepository/cenrepsrv/backup.cpp Thu Aug 19 11:36:21 2010 +0300
+++ b/persistentstorage/centralrepository/cenrepsrv/backup.cpp Tue Aug 31 16:57:14 2010 +0300
@@ -385,6 +385,15 @@
}
+void CRepositoryBackupClient::RestoreRepositoryAndListL(TUid repositoryUid, CDirectFileStore* store, TStreamId settingsStreamId, TStreamId deletedSettingsStreamId, TInt& repIndex)
+ {
+ // Add the restored repository to the restored repositories list.
+ // Pass its changed-keys list to further restoring functions to add entries for post-restoration notification.
+ repIndex = AddRestoredRepositoryL(repositoryUid);
+ iRepository->RestoreRepositoryContentsL(*store, settingsStreamId, deletedSettingsStreamId, *iRestoredRepositoriesArray[repIndex]);
+ iRepository->CommitChangesL();
+ }
+
//
// CRepositoryBackupClient::RestoreCompleteL
@@ -420,7 +429,6 @@
}
-
// Get the root stream and attempt to read a backup file header from it
TStreamId rootStreamId = store->Root() ;
RStoreReadStream rootStream ;
@@ -462,8 +470,8 @@
// Iterate through index and attempt restore of each repository stream
// we find in it.
- restoreStreamIndex->Reset() ;
- TUid repositoryUid ;
+ restoreStreamIndex->Reset();
+ TUid repositoryUid;
TStreamId settingsStreamId(KNullStreamIdValue);
TStreamId deletedSettingsStreamId(KNullStreamIdValue);
TStreamId installedSettingsStreamId(KNullStreamIdValue);
@@ -472,12 +480,10 @@
{
iRepository->OpenL(repositoryUid, *iNotifier, EFalse);
iRepository->FailAllTransactions();
- // Add the restored repository to the restored repositories list.
- // Pass its changed-keys list to further restoring functions to add entries for post-restoration notification.
- TInt repIndex = AddRestoredRepositoryL(repositoryUid);
- iRepository->RestoreRepositoryContentsL(*store, settingsStreamId, deletedSettingsStreamId, *iRestoredRepositoriesArray[repIndex]);
- iRepository->CommitChangesL();
+ TInt repIndex;
+ TRAPD(err, RestoreRepositoryAndListL(repositoryUid, store, settingsStreamId, deletedSettingsStreamId, repIndex));
iRepository->Close();
+ User::LeaveIfError(err);
// If the backup contains an installed repository containing default values for the settings, read them in
if (installedSettingsStreamId != KNullStreamId)
{