Search in sources :

Example 1 with StorageException

use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.

the class CompilerReferenceServiceImpl method getReferentFileIds.

@Nullable
private TIntHashSet getReferentFileIds(@NotNull PsiElement element) {
    final CompilerElementInfo compilerElementInfo = asCompilerElements(element, true);
    if (compilerElementInfo == null)
        return null;
    myReadDataLock.lock();
    try {
        if (myReader == null)
            return null;
        TIntHashSet referentFileIds = new TIntHashSet();
        for (LightRef ref : compilerElementInfo.searchElements) {
            try {
                final TIntHashSet referents = myReader.findReferentFileIds(ref, compilerElementInfo.place == ElementPlace.SRC);
                if (referents == null)
                    return null;
                referentFileIds.addAll(referents.toArray());
            } catch (StorageException e) {
                throw new RuntimeException(e);
            }
        }
        return referentFileIds;
    } finally {
        myReadDataLock.unlock();
    }
}
Also used : LightRef(org.jetbrains.jps.backwardRefs.LightRef) StorageException(com.intellij.util.indexing.StorageException) TIntHashSet(gnu.trove.TIntHashSet) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with StorageException

use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.

the class UpdateData method iterateKeys.

public void iterateKeys(KeyValueUpdateProcessor<Key, Value> addProcessor, KeyValueUpdateProcessor<Key, Value> updateProcessor, RemovedKeyProcessor<Key> removeProcessor) throws StorageException {
    final InputDataDiffBuilder<Key, Value> currentData;
    try {
        currentData = getCurrentDataEvaluator().compute();
    } catch (IOException e) {
        throw new StorageException(e);
    }
    currentData.differentiate(myNewData, addProcessor, updateProcessor, removeProcessor);
}
Also used : IOException(java.io.IOException) StorageException(com.intellij.util.indexing.StorageException)

Example 3 with StorageException

use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.

the class MapIndexStorage method removeAllValues.

@Override
public void removeAllValues(@NotNull Key key, int inputId) throws StorageException {
    try {
        myMap.markDirty();
        // important: assuming the key exists in the index
        read(key).removeAssociatedValue(inputId);
    } catch (IOException e) {
        throw new StorageException(e);
    }
}
Also used : IOException(java.io.IOException) StorageException(com.intellij.util.indexing.StorageException)

Example 4 with StorageException

use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.

the class MapIndexStorage method clear.

@Override
public void clear() throws StorageException {
    try {
        myMap.close();
    } catch (IOException e) {
        LOG.error(e);
    } catch (RuntimeException e) {
        LOG.error(e);
    }
    try {
        IOUtil.deleteAllFilesStartingWith(getStorageFile());
        initMapAndCache();
    } catch (IOException e) {
        throw new StorageException(e);
    } catch (RuntimeException e) {
        unwrapCauseAndRethrow(e);
    }
}
Also used : IOException(java.io.IOException) StorageException(com.intellij.util.indexing.StorageException)

Example 5 with StorageException

use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.

the class IndexDataGetter method buildFileNamesData.

@NotNull
public FileNamesData buildFileNamesData(@NotNull FilePath path) {
    FileNamesData result = new FileNamesData();
    VirtualFile root = VcsUtil.getVcsRootFor(myProject, path);
    if (myRoots.contains(root)) {
        try {
            myIndexStorage.paths.iterateCommits(Collections.singleton(path), (paths, commit) -> result.add(commit, paths));
            result.pack();
        } catch (IOException | StorageException e) {
            myFatalErrorsConsumer.consume(this, e);
        }
    }
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) IOException(java.io.IOException) StorageException(com.intellij.util.indexing.StorageException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StorageException (com.intellij.util.indexing.StorageException)9 IOException (java.io.IOException)7 TIntHashSet (gnu.trove.TIntHashSet)2 NotNull (org.jetbrains.annotations.NotNull)2 LightRef (org.jetbrains.jps.backwardRefs.LightRef)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1 Nullable (org.jetbrains.annotations.Nullable)1