Add defensive codes for broken AppRegistry file 80/14080/1
authorHyunbin Lee <hyunbin.lee@samsung.com>
Thu, 5 Dec 2013 13:09:09 +0000 (22:09 +0900)
committerHyunbin Lee <hyunbin.lee@samsung.com>
Mon, 23 Dec 2013 06:33:46 +0000 (15:33 +0900)
Change-Id: I040bc25866d646e320747c7a842cce9a7b3ba06b
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
src/app/FApp_AppRegistryImpl.cpp

index f3d39ed..307b059 100644 (file)
@@ -65,7 +65,14 @@ _AppRegistryImpl::Construct(void)
 
                Registry reg;
                r = reg.Construct(__regPath, "a+");
-               SysAssertf(!IsFailed(r), "[%s] Constructing the registry file (%ls) has failed.", GetErrorMessage(r), __regPath.GetPointer());
+               if (r == E_IO)
+               {
+                       r = File::Remove(__regPath);
+                       SysAssertf(!IsFailed(r), "[%s] Removing the registry file (%ls) has failed.", GetErrorMessage(r), __regPath.GetPointer());
+
+                       r = reg.Construct(__regPath, "a+");
+                       SysAssertf(!IsFailed(r), "[%s] Constructing the registry file (%ls) has failed.", GetErrorMessage(r), __regPath.GetPointer());
+               }
 
                FileLock* pReglock = reg.LockN(FILE_LOCK_EXCLUSIVE);
                SysTryLog(NID_APP, pReglock != null, "[%s] Locking the app registry file has failed.", GetErrorMessage(GetLastResult()));