AstLoadingFilter: don't report same traces multiple times

This commit is contained in:
Daniil Ovchinnikov
2018-04-08 22:39:01 +03:00
parent fe8c73ef71
commit 928da249fa
@@ -8,6 +8,7 @@ import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -64,6 +65,7 @@ import java.util.function.Supplier;
public class AstLoadingFilter {
private static final Logger LOG = Logger.getInstance(AstLoadingFilter.class);
private static final Set<String> ourReportedTraces = ContainerUtil.newConcurrentSet();
/**
* Holds not-null value if loading was disabled in current thread.
* Initial value is {@code null} meaning loading is enabled by default.
@@ -85,7 +87,10 @@ public class AstLoadingFilter {
// loading was disabled but then re-enabled for file
}
else {
LOG.error("Tree access disabled", new AstLoadingException(), new Attachment("debugInfo", buildDebugInfo(file, disabledInfo)));
AstLoadingException throwable = new AstLoadingException();
if (ourReportedTraces.add(ExceptionUtil.getThrowableText(throwable))) {
LOG.error("Tree access disabled", throwable, new Attachment("debugInfo", buildDebugInfo(file, disabledInfo)));
}
}
}