From f8f562946adf7f596e5b8a54cac82486a17ed484 Mon Sep 17 00:00:00 2001 From: Ruslan Cheremin Date: Fri, 30 Aug 2024 19:10:23 +0200 Subject: [PATCH] [vfs][indexes] IJPL-149673: filter out invalid ('alien') files before AssertionError is thrown + bandage for annoying 'Alien file...' exception in tests GitOrigin-RevId: cc1b83a160f33e7ecfcd6df10886acb025396cc1 --- .../util/indexing/contentQueue/IndexUpdateRunner.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/contentQueue/IndexUpdateRunner.kt b/platform/lang-impl/src/com/intellij/util/indexing/contentQueue/IndexUpdateRunner.kt index 6adf2b0dce42..bae93889f8b2 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/contentQueue/IndexUpdateRunner.kt +++ b/platform/lang-impl/src/com/intellij/util/indexing/contentQueue/IndexUpdateRunner.kt @@ -15,6 +15,7 @@ import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vfs.InvalidVirtualFileAccessException import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile +import com.intellij.openapi.vfs.VirtualFileWithId import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem import com.intellij.openapi.vfs.newvfs.impl.CachedFileType import com.intellij.platform.diagnostic.telemetry.IJTracer @@ -273,9 +274,14 @@ class IndexUpdateRunner( contentLoader: CachedFileContentLoader, statistics: IndexingFileSetStatistics, ) { - - // snapshot at the beginning: if file changes while being processed, we can detect this on the following scanning val file = fileIndexingRequest.file + if(!file.isValid){ + //this is a bandage for the annoying 'Alien file...' errors in tests: in real life it shouldn't be possible to come + // here with an invalid file, but in a (badly isolated) tests it could happen + LOG.warn("Invalid (alien?) file: #${(file as VirtualFileWithId).id}") + return + } + // snapshot at the beginning: if file changes while being processed, we can detect this on the following scanning val indexingStamp = indexingRequest.getFileIndexingStamp(file) val (applier, contentLoadingTime, length) = if (fileIndexingRequest.isDeleteRequest) {