rethrow PCE correctly when indexing

This commit is contained in:
Peter Gromov
2009-09-30 14:30:47 +04:00
parent 634b14732b
commit 39635b7e67
@@ -24,10 +24,7 @@ import com.intellij.openapi.project.*;
import com.intellij.openapi.roots.CollectingContentIterator;
import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Factory;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.ShutDownTracker;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.*;
@@ -1100,6 +1097,8 @@ public class FileBasedIndex implements ApplicationComponent {
PsiFile psiFile = null;
final Ref<ProcessCanceledException> pce = Ref.create(null);
final List<Runnable> tasks = new ArrayList<Runnable>();
for (final ID<?, ?> indexId : myIndices.keySet()) {
if (shouldIndexFile(file, indexId)) {
@@ -1132,8 +1131,7 @@ public class FileBasedIndex implements ApplicationComponent {
updateSingleIndex(indexId, file, _fc);
}
catch (ProcessCanceledException e) {
LOG.info("Re-scheduling file indexing for " + file.getPresentableUrl(), e);
myChangedFilesUpdater.scheduleForUpdate(file);
pce.set(e);
}
catch (StorageException e) {
requestRebuild(indexId);
@@ -1164,6 +1162,10 @@ public class FileBasedIndex implements ApplicationComponent {
}
}
if (!pce.isNull()) {
throw pce.get();
}
if (psiFile != null) {
psiFile.putUserData(PsiFileImpl.BUILDING_STUB, null);
}