[Box Backup-commit] COMMIT r3635 - box/trunk/lib/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Sat Aug 29 09:46:35 BST 2015


Author: chris
Date: 2015-08-29 08:46:35 +0000 (Sat, 29 Aug 2015)
New Revision: 3635

Modified:
   box/trunk/lib/backupstore/BackupAccountControl.cpp
   box/trunk/lib/backupstore/BackupStoreException.txt
Log:
Fix check for existing BackupStoreInfo file on S3 stores

Modified: box/trunk/lib/backupstore/BackupAccountControl.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupAccountControl.cpp	2015-08-29 08:46:22 UTC (rev 3634)
+++ box/trunk/lib/backupstore/BackupAccountControl.cpp	2015-08-29 08:46:35 UTC (rev 3635)
@@ -13,6 +13,7 @@
 #include <iostream>
 
 #include "autogen_CommonException.h"
+#include "autogen_BackupStoreException.h"
 #include "BackupAccountControl.h"
 #include "BackupStoreConstants.h"
 #include "BackupStoreDirectory.h"
@@ -188,10 +189,17 @@
 	std::string info_url = GetFullURL(S3_INFO_FILE_NAME);
 
 	HTTPResponse response = GetObject(S3_INFO_FILE_NAME);
+	if(response.GetResponseCode() == HTTPResponse::Code_OK)
+	{
+		THROW_EXCEPTION_MESSAGE(BackupStoreException, AccountAlreadyExists,
+			"The BackupStoreInfo file already exists at this URL: " <<
+			info_url);
+	}
+
 	if(response.GetResponseCode() != HTTPResponse::Code_NotFound)
 	{
-		mapS3Client->CheckResponse(response, std::string("The BackupStoreInfo file already "
-			"exists at this URL: ") + info_url);
+		mapS3Client->CheckResponse(response, std::string("Failed to check for an "
+			"existing BackupStoreInfo file at this URL: ") + info_url);
 	}
 
 	BackupStoreInfo info(0, // fake AccountID for S3 stores

Modified: box/trunk/lib/backupstore/BackupStoreException.txt
===================================================================
--- box/trunk/lib/backupstore/BackupStoreException.txt	2015-08-29 08:46:22 UTC (rev 3634)
+++ box/trunk/lib/backupstore/BackupStoreException.txt	2015-08-29 08:46:35 UTC (rev 3635)
@@ -73,3 +73,4 @@
 CorruptReferenceCountDatabase	70	The account's refcount database is corrupt and must be rebuilt by housekeeping.
 CancelledByBackgroundTask	71	The current task was cancelled on request by the background task.
 ObjectDoesNotExist		72	The specified object ID does not exist in the store.
+AccountAlreadyExists		73	Tried to create an account that already exists.




More information about the Boxbackup-commit mailing list