avoid synchronous index rebuild in tests to avoid problems with read action at hand

This commit is contained in:
Maxim.Mossienko
2015-07-15 15:13:43 +02:00
parent 8681c7d5b0
commit 0a80cddb3b
@@ -1210,6 +1210,10 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Nullable
public static Throwable getCauseToRebuildIndex(@NotNull RuntimeException e) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
// avoid rebuilding index in tests since we do it synchronously in requestRebuild and we can have readAction at hand
return null;
}
if (e instanceof IndexOutOfBoundsException) return e; // something wrong with direct byte buffer
Throwable cause = e.getCause();
if (cause instanceof StorageException || cause instanceof IOException ||