1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 510054 - Unrecoverable index file corruption

Change-Id: Iba386baf2c62f10044c4ffc1f399823a94aacf84
This commit is contained in:
Sergey Prigogin 2017-01-06 13:46:38 -08:00
parent fe3a787663
commit 7bfdf9a591
2 changed files with 10 additions and 5 deletions

View file

@ -425,10 +425,13 @@ public class PDOM extends PlatformObject implements IPDOM {
db = new Database(fPath, cache, getDefaultVersion(), isPermanentlyReadOnly());
db.setLocked(lockDB);
if (isSupportedVersion()) {
readLinkages();
try {
if (isSupportedVersion()) {
readLinkages();
}
} finally {
db.setLocked(lockCount != 0);
}
db.setLocked(lockCount != 0);
}
public IIndexLocationConverter getLocationConverter() {

View file

@ -384,8 +384,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
WritablePDOM pdom;
try {
pdom= new WritablePDOM(dbFile, new PDOMProjectIndexLocationConverter(project), getLinkageFactories());
} catch (CoreException e) {
CCorePlugin.log("Failed to open C/C++ index " + dbFile.getAbsolutePath() //$NON-NLS-1$
} catch (CoreException | RuntimeException e) {
// Index file is likely corrupted. Recover by rebuilding the index.
// See http://bugs.eclipse.org/510054
CCorePlugin.log("Failed to open C/C++ index file " + dbFile.getAbsolutePath() //$NON-NLS-1$
+ " - rebuilding the index", e); //$NON-NLS-1$
dbFile.delete();
fromScratch= true;