From dfa0b15073cfb228d4e10c8cd6393cd9c58b9527 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 22 Oct 2013 19:45:22 +0200 Subject: [PATCH] recover from PersistentHashMap storage format change --- .../api/indexer/CompilerOutputIndexer.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputIndexer.java b/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputIndexer.java index 16275b2108de..9641c54b6e25 100644 --- a/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputIndexer.java +++ b/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputIndexer.java @@ -21,10 +21,7 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.Consumer; import com.intellij.util.indexing.ID; import com.intellij.util.indexing.IndexInfrastructure; -import com.intellij.util.io.DataExternalizer; -import com.intellij.util.io.EnumeratorStringDescriptor; -import com.intellij.util.io.PersistentEnumeratorDelegate; -import com.intellij.util.io.PersistentHashMap; +import com.intellij.util.io.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; @@ -103,13 +100,17 @@ public class CompilerOutputIndexer extends AbstractProjectComponent { myIndexTypeQNameToIndex.put(index.getClass().getCanonicalName(), index); } initTimestampIndex(needReindex); - try { - myFileEnumerator = new PersistentEnumeratorDelegate( - IndexInfrastructure.getStorageFile(CompilerOutputIndexUtil.generateIndexId("compilerOutputIndexFileId.enum", myProject)), - new EnumeratorStringDescriptor(), 2048); - } - catch (IOException e) { - throw new RuntimeException(e); + File storageFile = + IndexInfrastructure.getStorageFile(CompilerOutputIndexUtil.generateIndexId("compilerOutputIndexFileId.enum", myProject)); + for(int i = 0; i < 2; ++i) { + try { + myFileEnumerator = new PersistentEnumeratorDelegate( + storageFile, + new EnumeratorStringDescriptor(), 2048); + } catch (IOException e) { + if (i == 1) throw new RuntimeException(e); + IOUtil.deleteAllFilesStartingWith(storageFile); + } } CompilerManager.getInstance(myProject).addCompilationStatusListener(new CompilationStatusAdapter() { @Override