private @Nullable <K, V, R> R processExceptions(final @NotNull ID<K, V> indexId,
                                                  final @Nullable VirtualFile restrictToFile,
                                                  final @NotNull GlobalSearchScope filter,
                                                  @NotNull ThrowableConvertor<? super UpdatableIndex<K, V, FileContent, ?>, ? extends R, StorageException> computable) {
    try {
      waitUntilIndicesAreInitialized();
      UpdatableIndex<K, V, FileContent, ?> index = getIndex(indexId);
      Project project = filter.getProject();
      //assert project != null : "GlobalSearchScope#getProject() should be not-null for all index queries";
      if (!ensureUpToDate(indexId, project, filter, restrictToFile)) {
        return null;
      }
      TRACE_OF_ENTRIES_LOOKUP.get()
        .indexValidationFinished();

      return ConcurrencyUtil.withLock(index.getLock().readLock(), () -> computable.convert(index));
    }
    catch (StorageException e) {
      TRACE_OF_ENTRIES_LOOKUP.get().lookupFailed();
      requestRebuild(indexId, e);
    }
    catch (RuntimeException e) {
      final Throwable cause = getCauseToRebuildIndex(e);
      if (cause != null) {
        requestRebuild(indexId, cause);
      }
      else {
        throw e;
      }
    }
    return null;
  }
private @Nullable <K, V, R> R processExceptions(final @NotNull ID<K, V> indexId,
                                                  final @Nullable VirtualFile restrictToFile,
                                                  final @NotNull GlobalSearchScope filter,
                                                  @NotNull ThrowableConvertor<? super UpdatableIndex<K, V, FileContent, ?>, ? extends R, StorageException> computable)