From 513b5b2339b6b7beff8fbe4543baf29975b6cb91 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 8 Oct 2018 13:23:35 +0300 Subject: [PATCH] IDEA-198167 NPE during offline inspection: ex.GlobalInspectionContextImpl - null --- .../ex/GlobalInspectionContextImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index cc2d7f92619b..bbdfa4e88a7c 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -491,12 +491,14 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp ((JobLauncherImpl)JobLauncher.getInstance()).processQueue(filesToInspect, filesFailedToInspect, wrapper, TOMBSTONE, processor); break; } - catch (ProcessCanceledException ignored) { + catch (ProcessCanceledException e) { progressIndicator.checkCanceled(); // PCE may be thrown from inside wrapper when write action started // go on with the write and then resume processing the rest of the queue - assert !ApplicationManager.getApplication().isReadAccessAllowed(); - assert !ApplicationManager.getApplication().isDispatchThread(); + assert isOfflineInspections || !ApplicationManager.getApplication().isReadAccessAllowed() + : "Must be outside read action. PCE=\n" + ExceptionUtil.getThrowableText(e); + assert isOfflineInspections || !ApplicationManager.getApplication().isDispatchThread() + : "Must be outside EDT. PCE=\n" + ExceptionUtil.getThrowableText(e); // wait for write action to complete ApplicationManager.getApplication().runReadAction(EmptyRunnable.getInstance()); @@ -911,9 +913,10 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp private final ConcurrentMap myPresentationMap = ContainerUtil.newConcurrentMap(); @Nullable - public InspectionToolPresentation getPresentationOrNull(@NotNull InspectionToolWrapper toolWrapper) { + private InspectionToolPresentation getPresentationOrNull(@NotNull InspectionToolWrapper toolWrapper) { return myPresentationMap.get(toolWrapper); } + @NotNull public InspectionToolPresentation getPresentation(@NotNull InspectionToolWrapper toolWrapper) { InspectionToolPresentation presentation = myPresentationMap.get(toolWrapper);